Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

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


Sign up now

glFrontFace GL_CW vs. GL_CCW question

4: Adsense

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   

154
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.

 



#2 Sponji   Members   

2418
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.