Pocket in a surface of a cube

I started with programming in OpenGL with MS Visuell C++. In my programm
I have an OpenGL graphic window, in which I will describe different 3-D-Objects, for example cube, blocks, etc, like in a CAD programm.

I have problems with the presentation of objects, that are parts of other objects or in other objekts, for example a pocket in the surface of
a cube. How can I draw the remaining surface without the pocket and the pocket in a simple way?

My trial with the depth buffer was not sucessfull.

What is the ideal lighting for these objects? Any recommendations?



Hi !

There are a number of ways to solve this.

Use some external library to create the mesh for you.

Use CSG operations, this can be done in OpenGL, google will give some url’s about this.

Use nurbs surface, with those you can add trimming curves to “trim” out parts of the surface and in your case put in something else.

Use nurbs surface, you can modifiy the control points to create dents in the surface.