Results 1 to 4 of 4

Thread: Problems with Culling faces

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    14

    Problems with Culling faces

    Hello. This is my first post here.(sorry about spelling)

    Got a prob with culling faces. I've enabled it using glEnable(GL_CULL_FACE).

    Then i load my scene, and i walk and mouselook , i cant' see some faces (about half of them).

    There'are about 10 textured cubes in my scene, and my render loop look like this :

    {
    glClear buffers
    glLoadIdentity

    glRotates(for camera)
    glTranslates (for camera)

    drawcubes()
    }

    nothing wrong , yes?
    I tryed glCullFace(GL_BACK), and glCullFace(GL_FRONT), but i still can't see some walls.

    thanks!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: Problems with Culling faces

    Hi,

    certainly your problem has something to do with the winding of the polys.
    If you enable culling, that means, that OpenGL will not draw polygons that you can only see from the back (GL_BACK) or from the front (GL_FRONT). So if you are on the back side of a poly and you look at it, you won´t see it. You could disable culling, then you see every polygon, or you have to tell gl proberly, which side is the front and which is the back.

    If you create a quad you have to use 4 vertices. If you say vertex 1 is at -1|1 (top left) and vertex 2 is at -1|-1 (bottom left) and vertex 3 is at 1|-1 (bottom right) and vertex 4 is at 1|1 (top right), than you created those vertices in a counter-clockwise winding (against the direction of the clock). So OpenGL thinks that the side you are looking at is the front. If you specify the vertices the other way round (-1|1; 1|1; 1|-1; -1|-1) gl thinks it is the back side.

    If you enable culling it is important to create the vertices in a special order so that they are really drawn, when you want them to be drawn. If you disable culling it doesn´t matter, how you create your vertices.

    Hope that helps you.
    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    14

    Re: Problems with Culling faces

    thank you very much!
    I created all quad's vertices in clockwise order. I'm going to rewrite function..

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2002
    Location
    Argentina
    Posts
    7

    Re: Problems with Culling faces

    you could use glFrontFace(GL_CCW), too.

Similar Threads

  1. Front faces, back faces and edge-on faces
    By sam_hawker in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-23-2017, 07:24 AM
  2. Problems with culling
    By aptt in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-23-2005, 03:46 AM
  3. Problems with depth test and culling
    By dee.dw in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-30-2003, 10:16 AM
  4. Cliping/culling problems 8-|
    By M/\dm/\n in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 11-25-2002, 12:14 AM
  5. Strange problems(Dissapearing Faces)!
    By XBCT in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 10-07-2000, 10:04 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