To draw something with a Batch one has to first call the {@link Batch#begin()} method which will setup appropriate renderstates. When you are done with drawing you have to call {@link Batch#end()} which will actually draw the things you specified.
All drawing commands of the Batch 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 Batch is managed. In case the OpenGL context is lost all OpenGL resources a Batch uses internally get invalidated. A context is lost when a user switches to another application or receives an incoming call on Android. A Batch will be automatically reloaded after the OpenGL context is restored.
A Batch is a pretty heavy object so you should only ever have one in your program.
A Batch 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 Batch has to be disposed if it is no longer used. @author mzechner @author Nathan Sweet
|
|
|
|