🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

how to create a cube by giving 8 coordinates

Started by
0 comments, last by GameDev.net 17 years, 6 months ago
Hi, i am in a plan to generate just by giving eight points in between glbegin and gl end... wat i mean is if i am givin any 8 points it must create a cube... if anybody knows solution on implementing this pls reply...............
Advertisement
If you want to be able to specify the eight points in any kind of order completly random you probably want to look up some triangle generation routines.
This quite tricky to do. Try searching for 'delaunay' on google and you will probably find alot of information on it.

Now, if you asume certain things the problem will be alot easier. For example you know it's always a cube and that the vertices is always specified in a certain order. Then what you have to do is pretty much just give it a list of 36 indices to build your 12 triangles from the 8 vertices.

As I said, if you want simple cubes I would probably set up a small utility class where I specify the center and a size to generate a cube for me.
This isn't of course the only or the best solution to your problem.

Hope anything of it makes sense to you and helps.

This topic is closed to new replies.

Advertisement