Archived

This topic is now archived and is closed to further replies.

GL object imports...

This topic is 5305 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 all! I have a 3DS and MD3 model importer which is all ok. What I want to know is would it be worth it to change it to use vertex arrays and if so how would I go about it? I know how to set up VARs and use them but my problem is in the animating of the model. For example currently I go through each vertex and calculate its new position from interpolating it according to its bone and key frames etc then render it with glVertex... The only way I can see to use VARs would be to loop through the verts, update their position and then use glDrawElements or whatever. But wouldn''t that result in two loops through the array? So what I''m wondering is would the speed gain from VARs be greater than the added loop? Thanks all...Catch ya

Share this post


Link to post
Share on other sites
1. create a vertex array and store each vertex of each face sorted by its face texture(each vertices even twice because of your UV coordinates

2.update your vertices and normals

3. render them as triangles with glDrawArray(...)

so make sure you store the index and the number of faces with the same texture

that way you only have to bind your textures once


as for the extra loop

you won t gain much additional performance on a single low polygon model
but the more models you get the more performance gain you get


another tip

if you render the same model multiple times
you could render all faces with the same texture of each mode at once and then switch to the next texture

i guess switching textures costs more performance than this little extra loop

Share this post


Link to post
Share on other sites