Im making a user interface using libgdx I created a Window class & a Textfield class, that both use clipping. I use the ScissorStack class of libgdx for clipping.
The Textfield is drawn inside the window class.
Window draw method :
ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), clipBounds, scissors);
ScissorStack.pushScissors(scissors);
//Draw textflied
ScissorStack.popScissors();
Textfield draw method:
clipBounds.setPosition(
700,
200
);
//Draw textfield image
ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), clipBounds, scissors);
ScissorStack.pushScissors(scissors);
//Draw text
ScissorStack.popScissors();
The current problem is on the Textfield class with this code :
clipBounds.setPosition(
700,
200
);
If I remove this code I don't get error.
This is the error :
Exception in thread "LWJGL Application" java.lang.IllegalStateException: Array is empty.
at com.badlogic.gdx.utils.Array.pop(Array.java:292)
at com.badlogic.gdx.scenes.scene2d.utils.ScissorStack.popScissors(ScissorStack.java:77)
I noticed that if I change the value of clipBounds, something I got the error, and sometimes, with some values, I dont get the error.
pushScissors
. If it returnsfalse
you should not callpopScissors
(and you don't need to draw anything). \$\endgroup\$