Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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.

  • You cannot reply to this topic
1 reply to this topic

#1 asyrov   Members   -  Reputation: 121

Like
0Likes
Like

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.

 



Sponsor:

#2 Sponji   Members   -  Reputation: 1360

Like
1Likes
Like

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.



PARTNERS