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

10,827

Solution 1

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

Solution 2

The documentation on glFrontFace says that the default is GL_CCW.

Share:
10,827

Related videos on Youtube

eonil
Author by

eonil

Favorite words: "Make it work, make it right, make it fast" — by Kent Beck? "...premature optimization is the root of all evil (or at least most of it) in programming." - from The Art of Computer Programming, by Donald Knuth. "Yes, but your program doesn't work. If mine doesn't have to work, I can make it run instantly and take up no memory." — from Code Complete, by Steve Mcconnell. "Flat is better than nested." — from The Zen of Python, by Tim Peters "Making decisions is slow." — from The Ninja build system manual, author unknown. "A little copying is better than a little dependency." - from Go Proverbs, by Rob Pike Preferred tools: macOS, iOS, Ubuntu. Rust, Swift, VIM, Xcode. SQLite, PostgreSQL, Redis. And a few more trivial stuffs. Feel free to fix my grammar. I always appreciate!

Updated on September 15, 2022

Comments

  • eonil
    eonil almost 2 years

    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.

    • Vaughn Cato
      Vaughn Cato almost 12 years
      I believe if the triangle is wound counter-clockwise that you are looking at the front.
    • Nicol Bolas
      Nicol Bolas almost 12 years
      "Anyway converting between them could take some cost." Alternatively, it could cost nothing. Just change the winding order in OpenGL; it's not hard.
    • eonil
      eonil almost 12 years
      @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.