Archived

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

John2002

OpenGL Objects with holes in OpenGL?

Recommended Posts

Hi all.I would like to know how could I draw objects with "holes" in OpenGL. Eg:I know how to draw a cube in OpenGL, but How could I make a "hole" in the cube for example a "triangular" hole and on this way I could "see" trhought this hole...? Tnx in advance for any help...

Share this post


Link to post
Share on other sites
The object with the hole would need to be modeled that way. It would have lots of tri's.


-----------------
| -------- |
| \ / |
| \ / |
| \ / |
| \/ |
-----------------


That picture would be the front and back of your cube. Cutting that into tri's will give at least 5 polys. So your complete cube with a triangular hole in it would have

4 - the sides.
10 - front and back.
6 - sides of the hole.

For a grand total of 20 triangles... A bit more than you thought, huh?

Later,
Landsknecht

[edited by - landsknecht on March 21, 2002 5:54:53 AM]

Share this post


Link to post
Share on other sites
ok tnx for the info, please: Do you know where could I find some "sample code" regarding this matter of objects with holes?

Tnx again...

Share this post


Link to post
Share on other sites
The best thing you could do is stop thinking about it the way you are. You ''object with hole'' is only a mesh model. Fing a tutorial to do meshes and you have your answers...

Landsknecht

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
look into boolen subtraction and union of meshes. this is used in 3d apps to subtract or weld two objects into one.

Share this post


Link to post
Share on other sites