Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Backface culling

This topic is 6920 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Backface culling is to suppress the backfaces polygons.
Backfacing polygons are pols that are not facing you, that''s the ones that you don''t need to render.

Imagine a plane.
It''s define by 2 quads, one for each face.
Do you really want to compute vertex lighting, mapping... on the side you don''t see ?
No, so you do backface culling.

OpenGL (as well as Direct3D) did it for you I think you must activate it (if it''s not the default value) with the glEnable() command.

Notice that OpenGL (and Direct3D) are doing backface 2D culling at the end of the process (just before displaying), you can save extra operations by doing 3D culling using surface normals before the projection as been computed.

In 3d gfx (like anywhere) you must suppress as much stuff as you can as soon as possible.

Hope it helps.

-* Sounds, music and story makes the difference between good and great games *-

Share this post

Link to post
Share on other sites
The actual code to do this is:

glCullFace( GL_BACK );
glEnable( GL_CULL_FACE );

Remember that the vertices of your triangles, polygons, etc, must entered counter-clockwise for it to work correctly;


Share this post

Link to post
Share on other sites
To clear up a little thing, you can actually set vertex order any way you want, and you can tell OpenGL which way will be forward.
You can set glCullFace( GL_FRONT ) , for example,
or use glFrontFace( GL_CCW ) or glFrontFace( GL_CW );

So basically, you can pick which way is forward if you want.

What morgan described is the default setting if you don''t change anything.

#pragma DWIM // Do What I Mean!
~ Mad Keith ~
**I use Software Mode**

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!