Results 1 to 5 of 5

Thread: Winding Challenged

  1. #1
    Member Contributor
    Join Date
    Jan 2001
    Location
    Portland, ME., USA
    Posts
    86

    Winding Challenged

    Hi,
    From what I understand, when vertices of a triangle are supplied, opengl will use the order they are provided in to determine the winding (cw or ccw) of the triangle. How does opengl do this?
    The difficulty I'm running into is: I would like to order the vertices of a triangle programmatically in CCW order before passing them to OGL so they won't get culled by OGL. I have triangles that are being culled and leaving triangular holes in my surface.

    I've examined past posts and have not come across a similiar problem.

    Thanks in advance.

    lobstah
    lobstah

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Winding Challenged

    Hi !

    You use glFrontFace() to select if clockwise or counterclockwise triangles should be front facing, that's all.

    Mikael

  3. #3
    Member Contributor
    Join Date
    Jan 2001
    Location
    Portland, ME., USA
    Posts
    86

    Re: Winding Challenged

    Hi Mikael,

    Thanks for taking the time to reply.

    The ogl setting is not the solution, unless there's something I'm missing.

    I have some triangles that are CW and the remaining are CCW. Those that are CW are being culled when I don't want them culled. So I figure the solution is to arrange the vertices in CCW order before passing to ogl.

    My thought was to find out how ogl determines what's CW and CCW, based on vertex ordering, and from the result, say if CW, swap vertex 2 and 3 of the triangle to make it CCW.
    lobstah

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: Winding Challenged

    Hi !

    OpenGL will not rearrange the vertices for you, you have to do that yourself.

    You can find the winding order if you have the vertices and the surface normal, if you then calculate the normal yourself it will point in the opposite direction if the winding order is incorrect.

    If you don't have a normal for the triangle i don't think you can find the winding order because you don't know in what direction the triangles should be facing anyway, so the winding order will always be correct the triangle will just face the opposite direction then what you where expecting.

    Mikael

  5. #5
    Member Contributor
    Join Date
    Jan 2001
    Location
    Portland, ME., USA
    Posts
    86

    Re: Winding Challenged

    Thank you.

    lobstah

    [This message has been edited by lobstah (edited 07-28-2003).]
    lobstah

Similar Threads

  1. Determing facet winding
    By JRGlide in forum OpenGL: General
    Replies: 4
    Last Post: 06-09-2013, 10:17 AM
  2. GL_TRIANGLE_STRIP Winding
    By bobGL in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-12-2007, 06:30 PM
  3. triangle winding.
    By Dixie Dude in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 10-22-2003, 02:29 AM
  4. Polygon's winding, and sil' edges winding
    By okapota in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-16-2002, 07:39 AM
  5. Polygon winding
    By mardn in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-19-2000, 04:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean