Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to draw a filled rectangle in Libgdx and according to the API this should work:


But it gives me an error and tells me to change FilledRectangle to Filled, Pointor Line.

imports: import;

Any ideas on what is causing this?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

If you read the documentation, you'll see that ShapeRenderer.ShapeType is an enum with the following values defined:


So the error message you're receiving is accurate.

If you want to draw a filled rectangle, choose the Filled enum type, then use shape rederer to draw a rectangle:

 shapeRenderer.translate(20, 12, 2);
 shapeRenderer.rotate(0, 0, 1, 90);
 shapeRenderer.rect(-width / 2, -height / 2, width, height);
share|improve this answer

With LibGdx 0.9.8 they removed ShapeyType.Rectangle, ShapeType.FilledRectangle and introduced Filled, Line, Point to optimize the shape rendering.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.