VertexArrays

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

Recommended Posts

Hi ! Let's say i have this struct(object struct)
[SOURCE]
struct Object
{

int numVertex;
int numFaces;
Point3f* vertices;
Point3i* faces;
Point3f* faceNormals;
Point3f* vertexNormals;

};
where point3i is
struct Point3i//this is in fact a face
{
int	i[3];

};
[/SOURCE]
In the rendering function i call: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(GL_FLOAT,0,glObj.logo.pObjects[0].faceNormals); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3,GL_FLOAT,0,glObj.logo.pObjects[0].vertices); //glDrawArrays(GL_TRIANGLES,0,glObj.logo.pObjects[0].numVertex); glDrawElements(GL_TRIANGLES,0,GL_UNSIGNED_INT,glObj.logo.pObjects[0].faces); for drawing object[0] Conclusions: -it works fine using glDrawArray that i commented but the vertices are not in the correct order like any 3dMax file so i need to use indices -it doesn't work using indices ? I hope you can help me out!

Share on other sites
Well i almost solved the problem :
glDrawElements(GL_TRIANGLES,0,GL_UNSIGNED_INT,glObj.logo.pObjects[0].faces); 0 was the number of elements that's why it didn't work.[lol]
But know the object i loaded look different than the one rendered with glVertex .This new one is thinner than the other ,
do you know one reason why is this happening?The File is an ASE in case this matters.

Is it necessary to disableglDisableClientState after drawing every object so you can point the new locations in memory of the new vertices , indices etc or only when going back to glVertex commands

Does the disabling order matters?

THX!

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631757
• Total Posts
3002140
×