Search code examples
openglgraphicsmodelingcsg

CSG Modeling in OpenGL


I am dealing with Constructive Solid Geometry(CSG) modeling with OpenGL.

I want to know how to implement binary operation. I read something about Gold Feather Algorithm and I know about OpenCSG but after reading its source code, I found it too complicated to understand. I just need a simple shortest OpenGL example how to implement it.

There's no restrict in Algorithm as long as it is easy to implement.


Solution

  • Nicol Bolas is correct - OpenGL will not help with CSG, it only provides a way to draw 3D things onto a 2D screen. OpenCSG is essentially "fake" CSG by using using OpenGL's depthbuffers, stencils and shaders to make it appear that 3D objects have had a boolean operation performed on them.

    CSG is a huge task and I doubt you will ever find an "algorithm easy to understand" Have a look at this project: http://code.google.com/p/carve/ which performs CSG on the triangles/faces which you would then draw to OpenGL