Jump to content
  • Advertisement
Sign in to follow this  
bioM

improve renderring speed?

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

i have a gif animation and want to renderring this gif as background of 3D screen. this is my algorithm : - create a texture for background. - use gdi+ funtion to get each frame buffer of the gif, copy pixel to pixel from this buffer to the top surface buffer of the texture and then render the texture. =>it worked but slow renderring. i have thought of one way to improve the speed that i will preload all frame buffers of the gif file into an array of texture and then render each element of this texture array at renderring time. is this a good way? i wonder should i deal with surface array or texture array? i still have less knowlege about this. as i know that a texture can contain many surfaces, but only one surface is active to render. can i active the other surface of this texture,and how many surface that a texture can have? so, 2 main thing i want to ask that any thing can i improve the speed? should i use surface or texture array?

Share this post


Link to post
Share on other sites
Advertisement
If you are currently copying the GIF data to the textures every frame, then this is a bad way to do it. Generating the textures at load-time and then never altering them again is fastest. Either an array of textures for each frame of the animation, or you could use a single 3D texture. Personally I'd go with the first approach. D3DX can load a .gif file I think as a single texture, but I don't know if there is a utility function to load an animated .gif. But just do your copying to the texture at load-time and it should get a LOT faster.

Share this post


Link to post
Share on other sites
I don't have that indepth knowledge of surfaces... but something you should do for sure is to at least preload the gif, but preferably load it onto a texture or other means for Direct3D to quickly access it.

Btw, as it is gif it cannot contain more than 256 colors, should be quite fitting to use a palette and an 8bit-texture if you are memory kinky, but could prove pretty troublesome too however. (remeber to turn off mipmapping for the textures)

(A tip is if it is a large gif, not to create 4096x4096 texture or so, but to keep it rather small)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I would recommend that depending on the performance tradeoffs, you do what
the other posters have said in conjunction with the possibility of a tradeoff
depending on your memory requirements. You might for example buffer the file
and decode the frames to a buffer on the fly. Generally though if you want good
speed you could probably just decode all the frames but then you get that extra
memory hit.

Share this post


Link to post
Share on other sites
Not especially. Once you create textures for each image of the animation you can free the memory for the GIF image. Use 8-bit textures as already suggested -you could even use a compressed texture to keep the size down.

Does .DDS support animations like this BTW?

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!