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: Backface culling

  1. #1
    Guest

    Backface culling

    on the internet I found this about backface culling:

    We need to do the following steps:

    1) Transform the camera position into object space

    2) For every face in object:

    2.1) Make a vector from the camera to a point on the face (a vertex)
    2.2) Perform dot produce on this vector with the face normal
    2.3) If dot product result is greater than 0, face is visable.
    If dot product result is 0, face is side on.
    If dot product result is less than 0, face is hidden.

    But... how do you send only once face and not the other? I mean when we send 3 verticies by glBegin(GL_TRIANGLES), we give it the option of drawing it with both faces... how do I implement this? and should I implement this or leave it to glEnable(GL_CULL_FACE); ??

  2. #2

    Re: Backface culling

    I am not sure I understand what you mean...

    You do your backface tests. If a face is hidden, do not do the glBegin() call at all. If it is visible, use glBegin().

    You can then disable GL_CULL_FACE because you are doing your own backface culling.

    Is this what you meant?

    [This message has been edited by drakaza (edited 08-12-2000).]

  3. #3
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: Backface culling

    >>>and should I implement this or leave it to glEnable(GL_CULL_FACE); ??

    Your method is useful when you don't care for the winding order of the triangles.

    OpenGL relies on the winding order to determine the front face (and therefore the correct lighting).

    If you know the winding order for all triangles (default GL_CCW) leave the culling to the OpenGL implementation.

Posting Permissions

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