New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprite vertex winding is not counter clockwise #3577

Closed
xoppa opened this Issue Nov 18, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@xoppa
Copy link
Member

xoppa commented Nov 18, 2015

I just noticed that unlike what the comment says, the vertex winding is not counter clockwise. If you look at the code, you'll see that it starts at the bottom left (fx, fy), then to the top left (fx, fy + height) and then to the top right (fx + width, fy + height), and so on. This will cause everything to be culled when back face culling is enabled. It is easy to reproduce, in any of the tests enable backface culling:

Gdx.gl.glEnable(GL20.GL_CULL_FACE);

Either switching to frontface culling (Gdx.gl.glCullFace(GL20.GL_FRONT);) or switching to clockwise winding (Gdx.gl.glFrontFace(GL20.GL_CW);) will make it appear again.

I noticed this when using the vertices of the Sprite class (to benefit from AtlasSprite) as base for a 3d surface. So it is not only SpriteBatch.

Although easy to fix, I'm not sure what the impact of it would be.

@NathanSweet

This comment has been minimized.

Copy link
Member

NathanSweet commented Nov 23, 2015

Yeah it's always been backward. Keeps you 3D guys on your toes! I wouldn't mind seeing it fixed. Maybe it would be a good time to also make Sprite not extend TextureRegion.

@badlogic

This comment has been minimized.

Copy link
Member

badlogic commented Dec 10, 2016

Don't see this happening :)

@badlogic badlogic closed this Dec 10, 2016

@NathanSweet

This comment has been minimized.

Copy link
Member

NathanSweet commented Dec 11, 2016

That's the spirit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment