View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# glFrontFace GL_CW vs. GL_CCW question

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1asyrov  Members

Posted 27 May 2014 - 01:25 PM

I'm confused about order of points in triangle to draw square. Here is my code to specify points of square and vertex indexes:

float z = 1;

static vec3 vt[] = {
{-z, -z,  0},   // bottom left corner
{ z, -z,  0},   // top left corner
{ z,  z,  0},   // top right corner
{-z,  z,  0}    // bottom right corner
};

static index_t id[] = {
0, 1, 2,
0, 2, 3
};

Now in my shader I have:

gl_FrontColor = vec4(1, 1, 1, 1.f);
gl_BackColor  = vec4(1, 0, 0, 1);

And I explicitly specify order:

glFrontFace(GL_CCW);

Now, mystery to me that that my points specified in clockwise order, but I see my square as white. Note that if I do GL_CW, it is red. I thought it should be other way around. Please help.

### #2Sponji  Members

Posted 27 May 2014 - 01:44 PM

Now, mystery to me that that my points specified in clockwise order, but I see my square as white.

CCW = counterclockwise

Try drawing the vertex positions on a paper, +x is to the right, +y is up, it's white when the order is counter clockwise.

Derp

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.