Spencer H
Spencer H

Reputation: 489

LibGDX Circle rendering

Hi I'm just starting to learn about LibGDX and I was wondering how to draw an actual circle. I'm using a orthographic camera object and shape renderer but whenever I draw a circle it's more of an ellipse

@Override //Circle paint function
public void paint(OrthographicCamera camera) {
    renderer.setProjectionMatrix(camera.combined);
    renderer.begin(ShapeType.Filled);
    renderer.setColor(Color.CYAN);
    renderer.scale(1f, 1f, 1f);
    renderer.circle(getX(), getY(), getSize());
    renderer.end();
}

//How I initialize the camera
camera = new OrthographicCamera(500, 500);

How it ends up looking:

I'm supposed to be a circle :( I mean I don't know about you, but I don't think that'

Upvotes: 1

Views: 441

Answers (1)

David Titarenco
David Titarenco

Reputation: 33396

Your orthographic camera ratio should be the same as the viewport ratio, otherwise perspective gets skewed as you've observed. If your viewport is 1.3 ratio (it looks like it is), the ratio of your camera should be the same.

Try: camera = new OrthographicCamera(650, 500);

Upvotes: 3

Related Questions