Question

I am reading several books about OpenGL and in two of them they always define the vertices counter clockwise. From what I read this is very crucial because it determines where the front and back is.

But I am also reading the tutorial on http://www.arcsynthesis.org/gltut/ And he defines 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,
};

Shouldn't I always use the counter clockwise notation, because that is the default in opengl?

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

Was it helpful?

Solution

Shouldn't I always use the counter clockwise notation, because that is the default in opengl?

That is your choice. You can use CCW or CW notation. You can always override this behaviour with glFrontFace(). There is no difference for the hardware, which way to work, but, I guess, chosing CW might cause some unexpected troubles when trying to use third-party library which prefers CCW or something like that.

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

It should be GLfloat. On the other hand, on most platforms float and GLfloat are exactly the same and one can't find any difference. Using GLfloat is better practice from portability point of view. Another consideration: it emphasizes that the variable is used for graphics rendering, so it's a good thing to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top