Jump to content
  • Advertisement
Sign in to follow this  

problem with normal with ArrayList

This topic is 4849 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.normals[ii])*3)],normalList[((tempy.normals[ii]-1)*3)+1],normalList[((tempy.normals[ii]-1)*3)+2] ); glVertex3f(vertexlist[ ((tempy.vertex[ii]-1)*3) ] ,vertexlist[ ((tempy.vertex[ii]-1)*3)+1 ] , vertexlist[ ((tempy.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  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!