# Thread: Modeling an irregular 3d polyhedron (using OpenGL and GLUT)

1. ## Modeling an irregular 3d polyhedron (using OpenGL and GLUT)

What are the basic steps of modeling an irregular 3d polyhedron (example "pentagonal hexecontahedron")?

I'm using GLUT.

What I understand so far is that I need to determine vertices of the object. How?
What's next when I have the vertex list? How do I use the glVertex(..) function to draw the polyhedron?

2. opengl - Irregular polyhedron modeling in 3d, GLUT - Programmers

opengl - Irregular polyhedron modeling in 3d, GLUT - Stack Overflow

While I do agree with the response you have already gotten that some attempt should be shown on your part that you are trying to solve the problem. You should at least break the problem down into smaller steps. I have no idea how much you already know about OpenGL since you have provided no code and this is your first post on this forum so I will guess that you are just starting.

If you aren't even sure how to draw a vertex to a screen then you might want to visit

NeHe Productions - Everything OpenGL

The tutorial is very understandable and has a good flow. I learned alot about openGL through those tutorials. Once you understand how to set up Vertex Lists and how to draw them to the screen on basic shapes you might be able to start thinking about how to do this more in depth. If you saw on the link you provided the shape itself can be unwraped into a series of smallersimpler shapes. You could try drawing an unwrapped version to the screen then you would know that you had an understanding and all the pieces needed to make the full shape.

From that point you could come up with a formula that would take a few arguments for diameter, and origin points, then you could calculate how far each vertex would be from the center based off the size. Since you know the shape is constant there will always be a constant mathamatical relationship between any given vertex and the center of the object.

Just make sure you put it all into a class so you can easily port it to any new projects. You could put all the data points in a structure and then have a class encapsulate it that would do certain functions you may want such has handling, drawing, textureloading, ect. You could set it to change size and even carry velocity parameters.

Or you could take the easy way out and make it in a 3d Creation program and then load it into your openGL via an already working library. Heck someone might even have the 3d model for sale somewhere on the internet if you know where to look.

Pentagonal Hexecontahedron by Gus - 3D Warehouse

3. I've already read the NeHe Productions - Everything OpenGL 01-06 lessons and understood the content.
Gonna try drawing the unwrapped version to the screen today, if I'll figure out where to start.
Thanks!

4. well if you remember it says somewhere in those tutorials that most rendering is done via triangles so you could break it down into triangle strips. It looks like it would take 4 triangles for the basic shape so 20 for a "group" of them and there are 12 groups.

So 240 triangles to draw that shape. Be careful when it comes to your vertice lists as a beginner the first impulse might be to save 3 vertices per triangle but if you think about it most of your triangles will share points with other triangles. So you just have to define "unique" vertices.

So you could draw the basic shape (the tear drop shape) with 4 triangles and 12 total vertices (the hard way) or you could notice that there are only six unique vertice coordinates and allow them to share these vertices. As you can see that already reduces the number of vertices to half. Now your next teardrop will share at least two vertices with this one so further reducing to 4 new unique vertices to a total of 10 to draw two of them connected rather than a list of 24.

Now realizing the scope of the shape if you did not reduce your list to unique points the final list would be 720 while the unique points will only be 92 according to the website you linked.

Hopefully that will help u reduce your time spent. If you don't quite understand due to my naturally verbose nature, let me know. I will draw a picture or two to illustrate the point.

This seems like a fun project. Is it for school or hobby? If you do finish I would be interested in seeing the code.