Jump to content

  • Log In with Google      Sign In   
  • Create Account


(MD5mesh parser) Opengl glVertexPointer to glCallList ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 wittyusername   Members   -  Reputation: 104

Like
0Likes
Like

Posted 23 September 2012 - 03:38 PM

I've been modifying this md5mesh loader/parser to comply with my engine and I would like to switch the display function to use OpenGL call lists as opposed to glVertex pointers
[source lang="cpp"]//original display function/* Draw each mesh of the model */ for (i = 0; i < md5file.num_meshes; ++i) { PrepareMesh (&md5file.meshes[i], skeleton); glVertexPointer (3, GL_FLOAT, 0, vertexArray); glDrawElements (GL_TRIANGLES, md5file.meshes[i].num_tris * 3, GL_UNSIGNED_INT, vertexIndices); }[/source]

[source lang="cpp"]//My function /* Draw each mesh of the model */ for (i = 0; i < md5file.num_meshes; ++i) { PrepareMesh (&md5file.meshes[i], skeleton); glVertexPointer (3, GL_FLOAT, 0, vertexArray); do { //glColor4f /*if transparent*/ glBegin(GL_TRIANGLES); //gltexcoord2f() //times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); //gltexcoord2f() times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); //gltexcoord2f() times = times + 1; glVertex3f(vertexArray[times][0],vertexArray[times][1],vertexArray[times][2]); glEnd(); times = times + 1; }while(times < md5file.meshes[i].num_tris); } glutSwapBuffers (); glutPostRedisplay ();}[/source]
. When I compiled it the outline of the model looks fine but the triangles of it are not correct.

Attached Files



Sponsor:

#2 Boruki   Members   -  Reputation: 681

Like
0Likes
Like

Posted 23 September 2012 - 11:27 PM

Something I noticed was your 'times' counter is going up every vertex but is then checked against the number of tris. Obviously it should be getting checked against the number of verts? Maybe just use the num_tris * 3?

#3 wittyusername   Members   -  Reputation: 104

Like
0Likes
Like

Posted 25 September 2012 - 08:19 PM

No thats not the problem, fixed it last night thanks anyway

#4 Boruki   Members   -  Reputation: 681

Like
0Likes
Like

Posted 25 September 2012 - 11:33 PM

Can you post what the problem was? Just in case others come across something similar? :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS