Advertisement

Setting up vertices for a cube

Started by January 07, 2001 01:27 PM
3 comments, last by Spartacus 24 years ago
Hi! This might be a stupid question but can someone tell me how to set up the vertices for a simple cube? I suppose the vertices should be setup as a triangle strip, and that''s what i have been trying to do, but the cube looks really strange and absolutely NOT like a cube . -René

Real programmers don't document, if it was hard to write it should be hard to understand

This is a bit tricky without knowing which API you are using, but anyway...

If you are using triangle strips, make sure they have the correct orientation, you have to specify the vertices in the right order or it will look screwed up.

You could, alternatively, use quads, in which case you need to specify corner vertices, also in the correct order (although it''s easier to see the correct order than when working with tri-strips). But more so, you must make sure you are thinking in 3D, and have aligned all the appropriate verts on the correct axis.

Uh... apart from that, if you are texturing your cube, make sure you are specifying texture co-ordinates correctly, or that could make it look messed up.

-Mezz
Advertisement
Thank you for the help. But i have checked the vertices lots of times and i thought everything was fine. Well, i am a beginner to Direct3D and have never done 3D before so i might have a wrong understanding of how Direct3D uses the vertices in the triangle strip to render the triangles. Here''s the vertices i have used:

{ 1, 0, 1, },
{ 1, 0, 0, },
{ 1, 1, 1, },
{ 1, 1, 0, },
{ 0, 1, 1, }, <- until this point i have the top and one side
{ 0, 1, 0, }, perfectly rendered, but this is where things
{ 1, 0, 0, }, starts looked screwed up.
{ 0, 0, 0, },
{ 1, 0, 1, },
{ 0, 0, 1, },
{ 1, 1, 1, },
{ 0, 1, 1, },
{ 0, 0, 0, },
{ 0, 1, 0, }

Can someone tell me how many vertices i should use for a cube when i am using triangle strips? Maybe someone could give me the right vertices for a cube and i might be able to figure out what i am doing wrong and how it should be done.

Thanks,
-René

Real programmers don't document, if it was hard to write it should be hard to understand

I''m not going to try to type out a massive list of vertices, but I''ll save you alot of time by saying: you CANNOT make a cube from just one triangle strip! You need to split it up into more strips or use a triangle list instead.
Simon PriceSi@VBgames.co.ukwww.VBgames.co.uk
Try this link wazooenterprises and select tutorials. Cya

This topic is closed to new replies.

Advertisement