Skip to content

Clipping, with the use of scissorstack

badlogic edited this page Sep 14, 2013 · 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

a note from the translation

Wiki Style Guide

Clone this wiki locally