2014-01-11 28 views
1
public void draw(ShapeRenderer renderer) { 
    renderer.begin(ShapeType.Filled); 
    renderer.setColor(color); 
    renderer.identity(); 
    renderer.translate(position.x, position.y, 0); 
    renderer.rotate(0, 0, 1.0f, angle); 
    renderer.ellipse(-width/2, -height/2, width, height); 
    renderer.end(); 
} 

Artifact視覺假象在libgdx

旋轉ShapeRenderer時,這是我所得到的與上面的代碼。

回答

1

嘗試使用這種方法:

public void ellipse(float x, 
        float y, 
        float width, 
        float height, 
        int segments) 

因爲:

public void ellipse(float x, 
        float y, 
        float width, 
        float height) 

只會調用第一個方法,並估計segments說法。也許這一步沒有優化。

+0

來源:http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html#ellipse%28float,%20float,%20float,%20float,%20int %29 – pixlhero

+0

其實我已經嘗試了自己輸入段數,它不能解決問題。 – madhoe

+0

好的...這個doesen't沒有回答原來的問題,但我的建議是,你可以使用帶有白色圓圈的紋理,然後着色,縮放和旋轉它。 (我不知道天氣比使用shapeRenderer更節省成本...) – pixlhero