Results 1 to 5 of 5

Thread: glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

  1. #1
    Member Newbie
    Join Date
    Dec 2002
    Location
    Stanford, Ca USA
    Posts
    36

    glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

    I am having a problem with hidden surface removal using glEnable(GL_CULL_FACE) for TRIANGLE_STRIPS. In the manual I read that the STRIPS will be written in the counterclockwise manner so that hidden surfaces are enabled (automatically), but when I draw a bunch of hills using triangles for flight simulation I only get half of them to be culled right. Is this automatic drawing feature not implemented in OpenGL????

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2002
    Posts
    156

    Re: glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

    the first 3 points are the first triangle.
    draw them counter clockwise. the next point will be combined !with the last 2 ones!. the triangle will be drawn correctly (counter clockwise), because the opengl-programmers are smart^^
    go vegan

  3. #3
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    201

    Re: glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

    who dont you try glEnable(GL_DEPTH_TEST) and then use glClear(GL_DEPTH_BUFFER_BIT)

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

    The winding order of triangle strips goes something like this. Assume you have a strip that looks like so:

    Code :
    1---3---5
    | / | / |
    2---4---6
    Doing a triangle strip with
    1,2,3,4,5,6

    Is equiavlent to doing individual triangles like so:
    1,2,3
    3,2,4
    3,4,5
    5,4,6

    Notice how the vertices get flipped around? That is so that they can easily all keep the same winding order
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Member Newbie
    Join Date
    Dec 2002
    Location
    Stanford, Ca USA
    Posts
    36

    Re: glEnable(GL_CULL_FACE); and TRIANGLE_STRIP

    Originally posted by mdog1234:
    who dont you try glEnable(GL_DEPTH_TEST) and then use glClear(GL_DEPTH_BUFFER_BIT)
    I have tried this but I get a screen in which all the objects are distored. I think I am unclear where to put the glClear(GL_DEPTH_BUFFER_BIT)and if it needs to be cleared before every swapbuffers.

Similar Threads

  1. glEnable(GL_CULL_FACE) and glEnable(GL_DEPTH_TEST)
    By RoiiG in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-03-2010, 11:06 AM
  2. TRIANGLE_STRIP + VBO
    By maximian in forum OpenGL: Advanced Coding
    Replies: 19
    Last Post: 12-01-2003, 07:19 PM
  3. TRIANGLE_STRIP vs. TRIANGLE_FAN
    By bleifrei in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-06-2003, 12:48 PM
  4. triangle -----> triangle_strip ????
    By celic in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-28-2002, 12:45 AM
  5. Does GL_CULL_FACE uses normals???
    By KRONOS in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-18-2000, 12:15 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