View Full Version : object help

03-19-2002, 06:04 PM
how to model a cube with a through hole in the center in opengl?
can we group objects together i.e. create new solid by boolean addition of two primitives?
thanx in advance.

03-19-2002, 10:50 PM
its not so easy, if you want boolean operations you have to code them by yourself or use some 3rd party code/tools etc...
but try (dirt way, because more data is used than needed) to split a cube in multiple cubes, 4 needed for a quadric hole, and place them around the hole ...

03-20-2002, 08:38 AM
Couldnt you draw a cylinder into the stencil buffer and then draw the cube with the cylinder masked out?

03-20-2002, 10:23 PM
Jeeeez: i think adityask want an object which has a pipe like hole, so you have too see the 'walls' of the hole, but your method wouldnt produce these 'walls', because you only clip away parts of the cube,( and if he uses backface-culling he wouldnt see much of the inner part of the cube)... and he also has to manage the stencil buffer correctly in you method...

03-23-2002, 01:15 PM
If you want to generate a real 3D object, the stencil can't help you to realize that. The surface of the cube is a four-edge polygon. In fact, the cude is made up of six polygons. So you can do that with the opengl routine about polygon. But the question is the standard Opengl routine can only handle the convex polygon, can't handle the concave polygon, as the case you said there are a hole in the polygon. The solution is using the routines provided by GLU libray, named tessalation object. Some these routines include gluNewTess(), gluTessCallback(), gluTessBeginPolygon(), gluTessEndPolygon......