Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Problems with depth test and culling

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    2

    Problems with depth test and culling

    Hello!

    I'm new to OpenGL and having some troubles. For programming I use Linux (Mandrake 9.1) with QT 3.2.1. I only want to use gl.h library, if it possible.
    For beginning I buy a book „Jetzt lerne ich Open GL“ (It's in German, maybe someone knows it!) It's mainly written for MS Visual C++, but the OpenGL commands should work under Linux too.
    I must say that I think I don't have any hardware support under linux because of lack of drivers fpr my ATI card. But I thought OpenGL can render all in software mode and so all commands can be used, or am I wrong here?

    My biggest problem is the GL_DEPTH_TEST. If I enable it, my scene is empty. I've searched for this issue in this forum and found a lot of threads but none helped me really. I've also set glDepthFunc(GL_LESS).
    Therefore I have some objects that are in front of the scene instead in the rear because I've defined them later in the code.

    My second „problem“ is the culling. If I use the code from the examples in the book. They use glCullFace(GL_FRONT) and everything looks fine. If I use this my front-sides are missing. If I use glCullFace(GL_BACK) under Linux the scene looks right. Both times glFrontFace(CCW) is used.

    I hope someone could help me. Until now I don't need anything of this in my later project. But I planned to have an animations scene and therefore I need the depth test.

    Greetings from Germany,
    Dee

  2. #2
    Guest

    Re: Problems with depth test and culling

    To answer the second part of your question, glCullFace() only draws either clockwise objects or counterclockwise objects. It leaves out the other and doesn't render it, to increase your FPS. You should either draw all your objects clockwise or counterclockwise, choose one. If you then use glCullFace(), it will only render the side that you can see, and the scene will run faster! I hope this answers your question.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    2

    Re: Problems with depth test and culling

    At first: Thanks for your help! I know the definition of the methods, but as you can see below they behave different in Windows and Linux.

    I'm a little bit wiser now with the help of another german forum. The depth test does now working right!

    But if you want to look at http://www.stud.uni-giessen.de/~su2754/opengl/ogl.htm

    The three Pictures show the result in Windows and two in Linux. After repainting the window (e.g. resize, etc.) I loose all my shadows in Linux. Why?

    And in Windows I set glFrontFace(GL_CCW) and flCullFace(GL_FRONT). But under Linux I get the wrong result as shown in the other pictures. Only with CCW and BACK it's shown right! Does Linux and Windows calculate this thing in different way?

    At the top of the htm-file there are Zip-Files with the whole Projects for Linux and Windows, executables ("ausführbare") for those who won't compile it and the main cpp-files.

    Maybe now someone can help me some more!

    Greetings, Dee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •