To draw something with a PolygonSpriteBatch one has to first call the {@link PolygonSpriteBatch#begin()} method which willsetup appropriate render states. When you are done with drawing you have to call {@link PolygonSpriteBatch#end()} which willactually draw the things you specified.
All drawing commands of the PolygonSpriteBatch operate in screen coordinates. The screen coordinate system has an x-axis pointing to the right, an y-axis pointing upwards and the origin is in the lower left corner of the screen. You can also provide your own transformation and projection matrices if you so wish.
A PolygonSpriteBatch is managed. In case the OpenGL context is lost all OpenGL resources a PolygonSpriteBatch uses internally get invalidated. A context is lost when a user switches to another application or receives an incoming call on Android. A SpritPolygonSpriteBatcheBatch will be automatically reloaded after the OpenGL context is restored.
A PolygonSpriteBatch is a pretty heavy object so you should only ever have one in your program.
A PolygonSpriteBatch works with OpenGL ES 1.x and 2.0. In the case of a 2.0 context it will use its own custom shader to draw all provided sprites. You can set your own custom shader via {@link #setShader(ShaderProgram)}.
A PolygonSpriteBatch has to be disposed if it is no longer used. @author mzechner @author Stefan Bachmann @author Nathan Sweet
|
|
|
|
|
|