Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 257
eonil Avatar asked Aug 18 '12 04:08

eonil


People also ask

What is winding order in OpenGL?

This is determined by the winding order of the triangle. Given an ordering of the triangle's three vertices, a triangle can appear to have a clockwise winding or counter-clockwise winding. Clockwise means that the three vertices, in order, rotate clockwise around the triangle's center.

Is OpenGL clockwise or counterclockwise?

Basically, your reasoning is slightly off when you say that OpenGL uses counter-clockwise by default. But for what? It is to determine what polygons are front - facing so that the polygons not visible are culled (not rendered).

What is winding order?

The order of a triangle's vertices are used to determine which side of a triangle is the front side. If you are looking at a triangle and the order of the vertices is counter-clockwise, then, by convention, you are looking at the front of the triangle. The order of a triangle's vertices is called the winding order.

How do you calculate winding order?

Winding can be either clockwise (CW) or counter-clockwise (anti-clockwise) (CCW), referring to the direction in which we pass through the vertices while looking down at the coordinate plane. In figure 1, the vertices of a polygon are listed with CW winding on the left and CCW winding on the right.


2 Answers

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

like image 86
Vaughn Cato Avatar answered Oct 19 '22 06:10

Vaughn Cato


The documentation on glFrontFace says that the default is GL_CCW.

like image 36
JWWalker Avatar answered Oct 19 '22 07:10

JWWalker