# how these cube vertices are defined??

hi this array is [6][4][4] array… it represents 6 faces of the cube and 4 vertices of each face.any one who can tell me how these vertices in the array are defined ex:{-1.0,-1.0,-1.0,1.0} this represents a vertex which is called in glVertex4fv(&cube_vertexes[0][0][0]); how these values in the “ex” are defined??

static float cube_vertexes[6][4][4] =
{
{
{-1.0, -1.0, -1.0, 1.0},
{-1.0, -1.0, 1.0, 1.0},
{-1.0, 1.0, 1.0, 1.0},
{-1.0, 1.0, -1.0, 1.0}},

{
{1.0, 1.0, 1.0, 1.0},
{1.0, -1.0, 1.0, 1.0},
{1.0, -1.0, -1.0, 1.0},
{1.0, 1.0, -1.0, 1.0}},

{
{-1.0, -1.0, -1.0, 1.0},
{1.0, -1.0, -1.0, 1.0},
{1.0, -1.0, 1.0, 1.0},
{-1.0, -1.0, 1.0, 1.0}},

{
{1.0, 1.0, 1.0, 1.0},
{1.0, 1.0, -1.0, 1.0},
{-1.0, 1.0, -1.0, 1.0},
{-1.0, 1.0, 1.0, 1.0}},

{
{-1.0, -1.0, -1.0, 1.0},
{-1.0, 1.0, -1.0, 1.0},
{1.0, 1.0, -1.0, 1.0},
{1.0, -1.0, -1.0, 1.0}},

{
{1.0, 1.0, 1.0, 1.0},
{-1.0, 1.0, 1.0, 1.0},
{-1.0, -1.0, 1.0, 1.0},
{1.0, -1.0, 1.0, 1.0}}
};

Don’t crosspost.

sorry for the crosspost

You’re really better off posting these questions in the Beginners forum too, you know.

what do you mean by posting in the beginners forum??again it ll lead to a cross post

I mean instead of posting to advanced in the first place. For this one done is done, but in future you should consider that a questions like this one might get you more meaningful answers in the beginners forum.

ex:{-1.0,-1.0,-1.0,1.0}
it is the values for each of the 4 coordinates, in this order : x,y,z,w
See glVertex4?? details here :
http://www.opengl.org/sdk/docs/man/xhtml/glVertex.xml

Now you may ask, x,y,z makes sense for a 3D cube, but what about w ? Why 4 dimensions ?
Short answer : it is not needed for a cube ! By default w is 1.0 for glVertex3??, like all your values by the way.
Long answer : it is useful to represent things “at infinity” by setting w to 0.0 like for horizon, sun, stars, etc. For more math details, read about homogenous coordinates and perspective projection.