What's the de facto standard of triangle winding direction in OpenGL?
Asked Answered
D

2

24

We have two options in triangle winding direction,

  1. clock-wise
  2. counter-clockwise

Anyway converting between them could take some cost. I want to avoid conversion as much as possible, and to do that, I need to know de facto standard of winding direction. I think there's one because many big corporations are using OpenGL, and I think if there's one direction which is used by most of them, that's de facto standard.

If there's no such thing, please let me know.

Doubleton answered 18/8, 2012 at 4:37 Comment(3)
I believe if the triangle is wound counter-clockwise that you are looking at the front.Deepfreeze
"Anyway converting between them could take some cost." Alternatively, it could cost nothing. Just change the winding order in OpenGL; it's not hard.Singleness
@NicolBolas Well... in theory, it's just only changing a state, but in practice, I have many problems when using dual facing. For example, when merging meshes, when mixing vertex attributes. And it needs all meshes to be tagged with facing. Processing logic also should be branched. Also, it makes me to make more mistakes for increased possibilities.Doubleton
D
29

The OpenGL Programming guide says "By convention, polygons whose vertices appear in counterclockwise order on the screen are called front-facing."

Deepfreeze answered 18/8, 2012 at 4:45 Comment(0)
A
17

The documentation on glFrontFace says that the default is GL_CCW.

Alcove answered 18/8, 2012 at 4:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.