[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]
VertexArrays
Hi !
Let's say i have this struct(object struct)
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!
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.
THX!
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement