Is it possible to draw shapes by using ShapeRenderer
between SpriteBatch
begin
and end
calls.
I have tried but no result, only SpriteBatch textures are drawn, no shape is on the scene. Sample code is as followed below :
shapeRenderer.begin(ShapeType.FilledCircle);
shapeRenderer.setColor(0f, 1f, 0f, 1f);
shapeRenderer.filledCircle( 100, 100, 100);
shapeRenderer.end();
I have a orthographic camera created by these commands :
camera = new OrthographicCamera(1, Gdx.graphics.getHeight() / Gdx.graphics.getWidth());
camera.setToOrtho(true);
Both
ShapeRenderer
andSpriteBatch
set state in OpenGL that they expect to remain constant during their use. Nesting them can create problems. See this post in the badlogic forum.This should probably be spelled out a bit more clearly in the docs.