# Vertex Array confuse

This topic is 4254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi Im newbee plzz help me If I have array of vertex for a cube like this
float CubeVert[24] = { a , b ,c ,   d, e,f ,
g , h ,i ,   k, l,m ,
n , o ,p ,   q, r,s ,
t , u ,v ,   w, s,y };


Each groups of three Letters presents 1 vertex Cube includes 8 vertices ; I also got
unsigned int CubeFace[24]={ a , b , c , d,
e , f , g , h,
i , k , l , m,
n , o , p , q,
r , s , t , u,
v , w , s , y};


6 Faces for the cube presented in index format (Letters presented in 2 arrays aboves a not the same numbers ,just use for fast and easy typing ) I know that if I call glDrawElements(GL_QUADS,24,GL_UNSIGNED_INT,CubeFaces); It will draw a cube But the thing I confuse is how to assgin texture to that cube for 6 faces float CubeTex[?] = { ? ? ?..... } what is the format of the CubeTex ? suppose I have one texture 2D For the CubeTex Array , Do I have to specify it in reference to the CubeFaces or CubeVert for Ex: +In respect to CubeFaces:
 CubeTex[48]= { a , b // TexCoord 0
c , d // TexCoord 1
..... // TexCoord n
x , y // Textcood 47


48 = (24 Indexed Vertices ~~ 24 TexCoords) * (2 Tex coordinates); +In respect to CubeVert :
 CubeTex[16]= { a , b // TexCoord 0
c , d // TexCoord 1
..... // TexCoord n
x , y // Textcood 15


16 = (8 Vertices ~~ 8 TexCoords) * 2( Tex Coordinates); -------------------- Those 2 formats above are just what I think , Im not sure if it right or not Plzzz help me , it would be great to me if an explanation goes with a simple Example Thanks [Edited by - PenguinGLX on April 21, 2007 1:26:31 PM]

##### Share on other sites
Anyone here plzz help me
I tried 2 formats above ,and it still doesnt work

##### Share on other sites
if each face has the same texture you proceed like this
bind_texture(...);
draw_array();

if the sides have different textures you need to proceed like this

//each facegroup represents all the faces with sharing the same texture
for(i=0 to numfacegroups)
{
bind_texture(texids);
draw_array(face)
}

if your faces have different textures, you most likely have to add duplicate vertices to your vertex array since the texture coordinates might vary dependent on the texture and each vertex is strictly associated with one texture coordinate(theres no index to texture coordinates on per vertex basis)

just pseudo code to point out the mechanism
theres nothing like a textureid_array!

1. 1
2. 2
3. 3
Rutin
12
4. 4
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633695
• Total Posts
3013383
×