# OpenGL vertices for rotation

## Recommended Posts

I am trying to write a program to rotate an octagon cube. I have the front

and back faces completed. I can't seem to figure out the vertices for the

Thanks for your time! Here are the front vertices:

(-0.5, -1.0, 1.0)

(0.5, -1.0, 1.0)

(1.0, -0.5, 1.0)

(1.0, 0.5, 1.0)

(0.5, 1.0, 1.0)

(-0,5, 1.0, 1.0)

(-1.0, 0.5, 1.0)

(-1.0, -0.5, 1.0)

##### Share on other sites

You should watch the whole video, but go to 45:45 for your specific question.

##### Share on other sites

Well first off I'm not sure what an octagon cube is. An octagon is a 2D polygon and a cube is a 3D solid. What you have looks like an octagon as all the Z coordinates are 1.  However it's not a regular octagon.  If you want a regular octagon you have to do something like this:

https://en.wikipedia.org/wiki/Octagon#/media/File:Octagon_in_square.svg

There is also an octahedron which is a 3D 8 sided solid and looks like this:

https://en.wikipedia.org/wiki/Octahedron#/media/File:Octahedron.jpg

Perhaps you are tying to do some sort of extruded octagon.

##### Share on other sites
3 hours ago, Gnollrunner said:

Well first off I'm not sure what an octagon cube is.

I'm pretty sure he meant polygon cube.

##### Share on other sites
16 minutes ago, fleabay said:

I'm pretty sure he meant polygon cube.

Well ..... if you follow his vertexes they form an octagon, so I'm not sure what he meant and in any case a polygon is 2D also, while a cube is 3D.

Edited by Gnollrunner

##### Share on other sites

Thanks for all the help. Very interesting video. What I want to do is

instead of a cube with 4 sides per face, I want to do a cube with each face

having 8 sides. I would then texture each face and fill in the corners

with color. How to apply the vertices for the right side and top is giving

me the problem. In other words how do I arrange the vertices to make

the octagon on the right side and top so I can rotate the cube and it look

like it should. Hope I am being clear in what I have said. Thanks for any

help.

##### Share on other sites

Hey, that looks exactly what I am trying to do! I didn't know

what it was called but it looks like what I need. Is there any

information available for this? Thanks!!!!!!!!!!!!!

Edited by MannyMoe

##### Share on other sites

I just looked on Wikipedia..... In any case you already have one side, so you just need six of those at different orientations. If you want real regular octagons though you should use the formula for the edges from the picture I posted in my first post.  I'm not an expert on OpenGL but I imagine if you are doing this from raw OpenGL you will have to generate a vertex list with each vertex in it, and an index list that defines the triangles which build your truncated cube.  Are you already familiar with OpenGL? If not I would watch the whole video fleabay posted.

##### Share on other sites

Yes, I am quite familiar with Opengl and Allegro 5. I have already written

many programs to render some geometric shapes. This one just seems

to be impossible for me to figure out. I guess I am getting too old. I will

keep trying to figure this out. Thanks for your time. Have a great day!

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634113
• Total Posts
3015570
×