Search code examples
javaandroidlibgdxshapesgeometry

Rendering wrong Shape in libgdx? (Circle appearing as a diamond)


Im triying to draw some circles, but for some reason its drawing diamonds.

A picture of whats going on: Screenshot

The part of the code where im drawing the circles:

ymove = this.yO + espacioPerCasilla/2;
    for (int i=0; i< dimension; i++) {
        xmove = this.xO + espacioPerCasilla/2;
        for (int j=0; j< dimension ; j++) {
            shapeRenderer.setProjectionMatrix(MyGdxGame.camera.combined);
            shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
            shapeRenderer.setColor(Color.YELLOW);
            shapeRenderer.circle(xmove,ymove,Circulo.calcularRadio(espacioPerCasilla));
            shapeRenderer.end();

            xmove = xmove + espacioPerCasilla;
        }
        ymove = ymove + espacioPerCasilla;
    }

Before printing the circles i drew the grid using lines


Solution

  • My first guess is that you're drawing too small.
    Raise your dimensions to be on the double digits at least.

    Try this circle(float x, float y, float radius, int segments)
    Segments beeing the number of vertex to be drawn, make it 10, and see how it changes the shape of your circle.
    Then raise it until it's acceptable.