A Simple Cube

Started by
14 comments, last by Fabio 21 years ago
quote:Original post by Anonymous Poster
width /= width;
height /= height;
depth /= depth;

HAHAHAHAHAHAHA
YOU are right!!!!
I didn''t see it... ( I think I am blind )
should be
width /= 2.0f;
height /= 2.0f;
depth /= 2.0f;

Thanks...
;-)
---I''m learning...
Advertisement
Only one more question...

I have 2 squares...
Front Square and Back square, ok ?

How is the order of the vertices ?
Back Square            Front Square0----1                 4----5|    |                 |    |2----3                 6----7  

is it ?

I don''t know what is the right order...
---I''m learning...
Your question depends on which side of the square you are facing(assuming you are using clockwise winding). When you create a polygon, by specifying the winding of the polygon, you are telling Opengl(or directx or whatever) that a polygon has 2 sides; a front and a back face(this allows you to see the inside of a box if you leave 1 face missing). When you use a specific culling mode(you could use no cull mode and then not worry about any of this) you are telling the graphics API not to draw a backface. So how does this apply to your question? Lets look at just 1 of your squares:
0---1
| |
| |
2---3

If we say that this is the front of the square, then we would use these indices to create that effect: 013, 032 or whatever order you prefer, as long as they are being wound clockwise. However, to make this the backface, you would use the winding: 102, 231. Now you would not see the polygon, as you are removing backfaces by using backface culling. I hope this is enough to help you figure out your question. If you are confused, feel free to inquire some more!
quote:
If we say that this is the front of the square, then we would use these indices to create that effect: 013, 032 or whatever order you prefer, as long as they are being wound clockwise. However, to make this the backface, you would use the winding: 102, 231. Now you would not see the polygon, as you are removing backfaces by using backface culling. I hope this is enough to help you figure out your question. If you are confused, feel free to inquire some more!

Thanks, you help me a lot...
I finally understand the index buffer.
I''m very glad with your help.




---I''m learning...
and now...
I have an doubt about Normal.

What does the Normals do ?
Is it only for lighting calculations ?

I thought that The normals are used to specify the front face of the polygon. Am I wrong ?

---I''m learning...
Yes, The normal is for lighting only. The ''winding'' of the vertices is what determines the front or back of a face/triangle.

This topic is closed to new replies.

Advertisement