简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM