Sign in to follow this  

problem with normal with ArrayList

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folk, I hope you guys can help me out of this. I try to speed up my obj viewer with vertex array list and drawelements. If i try to display the objectin( in normal mode between glbeg) and glend() it display correctly. If it try to display the same object with gldrawelements is get normals problems.All the normals are wrong, b8ut when i switch to display it in glbegin() and glend() is get the right result. what i'm doing wrong ??? thx in advance. evl_one ps : here is the code with the normal mode : glBegin(GL_TRIANGLES); for(int i = 0; i< totpoly;i++) { glColor3f(1.0f,0.5f,0.0f); for(int ii=0; ii<3;ii++) { glNormal3f(normalList[((tempy[i].normals[ii])*3)],normalList[((tempy[i].normals[ii]-1)*3)+1],normalList[((tempy[i].normals[ii]-1)*3)+2] ); glVertex3f(vertexlist[ ((tempy[i].vertex[ii]-1)*3) ] ,vertexlist[ ((tempy[i].vertex[ii]-1)*3)+1 ] , vertexlist[ ((tempy[i].vertex[ii]-1)*3)+2 ]); } } glEnd(); and i use this code to display in vertex array. glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); vector3D position = (*iObjectCounter)->getTranslate(); glTranslatef(position.x,position.y-7.0f,position.z-20.0f); vector3D vRot = (*iObjectCounter)->getRotation(); glRotatef(vRot.x,0.0f,1.0f,0); glVertexPointer(3, GL_DOUBLE, 0, vertexlist); glNormalPointer(GL_DOUBLE, 0, normalList); glColor3f(1.0f,0.5f,0.0f); glDrawElements(GL_TRIANGLES, (*iObjectCounter)->getTotalFaces()*3 , GL_UNSIGNED_SHORT,(*iObjectCounter)->getFaceList() );

Share this post

Link to post
Share on other sites
Sign in to follow this