Hi,
i met a problem at glDrawElements function. I use the following codes to test.
glVertexPointer(3, GL_FLOAT,0,vertices);
glNormalPointer(GL_FLOAT,0, normals);
glDrawElements( GL_TRIANGLES, NUM_DUCK_FACES * 3, GL_UNSIGNED_BYTE, index );
i think glDrawElements is equal to these codes, i know there is no glVertex in Opengl es, i just want to show what glDrawElements does :
glVertex(vertices(index[0]));
glNormal(normals(index[0]));
glVertex(vertices(index[1]));
glNormal(normals(index[1]));
.....
That is to say vertex and normal have the same index, am i right? but when i have two index for vertex and normal what i can do?
For example,
static const GLfloat objVertexBoat[]={.....}
static const GLbyte objNormalBoat[]={.....}
static const GLubyte objVertexIndexBoat[]=
{0,2,3,
0,3,1,
....
}
static const GLubyte objNormalIndexBoat[]=
{0,1,2,
0,2,3,
....
}
That is to say normal has its index for every vertex. So how can i use glDrawElements? Need i change the index of normal to be the same with vertex?
Any other simple way?
Another question, what do uv means? i think they are not the same with ST. Because the value of uv often is not in range 0 and 1.
Looking forward to fast replying. Thank you
Mia