Vertical Counter / Clockwise

I read several books about OpenGL, and in two of them they always define vertices counterclockwise. From what I read, this is very important because it determines where the front and back are.

But I also read the tutorial at http://www.arcsynthesis.org/gltut/ And it identifies them clockwise.

const float vertexPositions[] = { 0.75f, 0.75f, 0.0f, 1.0f, 0.75f, -0.75f, 0.0f, 1.0f, -0.75f, -0.75f, 0.0f, 1.0f, }; 

Should I always use counterclockwise notation because this is the default value in opengl?

Also why is the type a float ? Shouldn't it be GLfloat ?

+6
source share
1 answer

Shouldn't you always use counterclockwise notation, because it's the default in opengl?

This is your choice. You can use CCW or CW notation. You can always override this behavior with glFrontFace() . For the hardware, it makes no difference which way it works, but I think using CW may cause some unexpected problems when trying to use a third-party library that prefers CCW or something like that.

Also why is the type float? Won't it be GLfloat?

It should be GLfloat . On the other hand, on most platforms, float and GLfloat exactly the same, and there can be no difference. Using GLfloat is best practice in terms of portability. Another consideration: it emphasizes that the variable is used to render graphics, so that’s good.

+9
source

All Articles