Sign in to follow this  

Recuding calls to Draw(Indexed)Primitive

This topic is 2847 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

Hey there Im facing some problems with rendering complex objects in my scene. Those objects are built from several textureunits. Lets say we have an average of 10 units per model. As in a single scene there may be up to 100 models this results in up to 1000 calls to DrawIndexPrimitive (they all are ID3DXMesh). As you can imagine this is pretty bad for the FPS. Does anyone of you know an algorithm or something to reduce this huge amount of calls? Greetings

Share this post


Link to post
Share on other sites
Well, the only real options are:
1. Combine several textures into one larger texture
2. Cull invisible meshes
3. Sort so you draw all meshes using texture A, then all using texture B, etc.

#1 sounds simplest.

Share this post


Link to post
Share on other sites
Yes, #1 sounds good as i am already doing #2 as good as possible. Is there a way to combine some textures during runtime? This is neccessary because the textures i use are already existing and i dont want to supply them all with my program.

Share this post


Link to post
Share on other sites
Quote:
Original post by Plerion
Yes, #1 sounds good as i am already doing #2 as good as possible. Is there a way to combine some textures during runtime? This is neccessary because the textures i use are already existing and i dont want to supply them all with my program.
What do you mean they already exist?

It's possible to do at runtime, but it's a bit of a pain to do. You'll need to:
1. Create a new large texture
2. Go through each texture the mesh uses and copy them into the larger texture
3. Lock the attribute and vertex buffer of the mesh
4. Update the texture coordinates in each vertex to correspond to the new coordinates
5. Unlock the AB and VB

Share this post


Link to post
Share on other sites
It means that its an extension to an existing game and so all the textures are from this game and i cannot ship all the textures with the program (nor do i really want to).

So i think this will be the only way. But that should be possible i guess. I will start implementing that.

Share this post


Link to post
Share on other sites

This topic is 2847 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