[Bf-committers] Backface cull

Robin Allen r.a3 at ntlworld.com
Mon Nov 20 17:27:24 CET 2006


I've made a backface cull patch 
http://projects.blender.org/tracker/index.php?func=detail&aid=5267&group_id=9&atid=127 
which enables backface culling of meshes in the viewports.

Instructions to test:

- Make a cube, flip its normals, set it to one-sided
- Go View->View Properties and click Backface Cull

Now only the interior faces of the cube are drawn. This is useful (for 
me, at least) for level design when working on interiors.

One slight issue: I had to change the code that draws the selection 
rectangle (drawobject.c:1444) because DerivedMesh.drawFacesSolid starts 
looking funny when backface culling is on. I'm sure the problem's in 
that function and its use of GL_LINES but I don't know the code well 
enough to change it. Instead, I've made it use the same method for 
drawing outlines as is already used for OB_DRAWTRANSP; that is, setting 
glPolygonMode to GL_LINE.

If there are any adverse effects of not using drawEdges then drawEdges 
should be changed to use glPolygonMode instead, and dm->drawEdges should 
be uncommented again.


More information about the Bf-committers mailing list