Sign in to follow this  

vertex arrays from 3ds files?

This topic is 4531 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, I'm trying to optimise this visualization program I've written by using vertex arrays. The meshes are imported from 3ds files. How would I go about extracting indices information from the 3ds file to pass to glDrawElements? And is there a way to convert the mesh into triangle trips (and is that even worth my time)? Also, is it better to store all geometry in a single array or keep a seperate one for each model I'm importing? How about normals? Interleaved or seperate? Any other optimisation hints? Thanks

Share this post


Link to post
Share on other sites
I don't remember the exact format of 3ds and I'm lazy, so I'll let someone else answer that part.

I'll mention VBOs (Vertex Buffer OBjects) at the end of this post, you should use those, not Vertex Arrays if you can.

to convert to triangle strips you can check out this link
Generally, models are closed - meaning that each edge is shared by 2 polygons and in turn, each vertex is shared by *at least* 2 polygons. Converting to triangle strips, each vertex is used only once meaning you'd have to push *at least* 50% fewer vertices through the graphics pipeline. It's probably a worthwhile project.

I would store all of my models in their own vertex arrays because if you delete an object, you don't have to search through the monolithic array and rearrange it, you simply delete its vertex array. If you're going to store normals (which you probably will want to) and / or colors I hear it's faster to use interleaved arrays. My implementation uses seperate arrays for each attribute...I don't know how much a performance boost you can expect using interleaved arrays.

VBOs - remember that when you use vertex arrays you have to upload the data to the card each frame. If your geometry is static - that is it's not morphing and the only type of transformations it will undergo are affine then you should use VBOs. A vertex buffer object is uploaded to the graphics board once and then stays resident there, so you don't have to push your geometry data across the bus each frame.

that's about it from me,
have fun.

Share this post


Link to post
Share on other sites
I believe VBOs where approved by the ARB about 2 years ago. I'd be surprised to find a card in the past year or two that doesn't support them.

It's generally a good idea to check name strings before you use features anyway.

check that the name GL_ARB_vertex_buffer_object is supported, if not you can always fall back to Vertex Arrays.

Share this post


Link to post
Share on other sites
Yeah, I ask because I wrote a quick routine to check if an extension was supported and it returned that VBO's weren't supported, and this is on a brand new nvidia quadro of the expensive variety.

I was in the process of setting up linux on this new machine so maybe it's a problem with the linux driver or the X.org install. I'll look into that.

Thanks for the tips.

EDIT: yeah I restarted and its showing up as supported now.

Share this post


Link to post
Share on other sites

This topic is 4531 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this