Skip to content

Clipping, with the use of scissorstack

basherone edited this page Dec 25, 2014 · 1 revision

Clipping

Rectangle scissors = new Rectangle();
Rectangle clipBounds = new Rectangle(x,y,w,h);
ScissorStack.calculateScissors(camera, spriteBatch.getTransformMatrix(), clipBounds, scissors);
ScissorStack.pushScissors(scissors);
spriteBatch.draw(...);
spriteBatch.flush();
ScissorStack.popScissors();

This will limit rendering to within the bounds of the rectangle "clipBounds".

It is also possible push multiple rectangles. Only the pixels of the sprites that are within all of the rectangles will be rendered.

Table of Contents

Wiki Style Guide

Clone this wiki locally