Advertisement Jump to content

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

right and top faces. Can someone please help me?

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 this post

Link to post
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:

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

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

Share this post

Link to post
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 this post

Link to post
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


Share this post

Link to post
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 this post

Link to post
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 this post

Link to post
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!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!