Jump to content
  • Advertisement
Sign in to follow this  
UHHH Internet

Jpegs in Directx

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

Advertisement
You can just use the D3DX functions for loading them - D3DX supports them out-of-the-box. You can also save JPGs using D3DXSaveTextureToFile/D3DXSaveSurfaceToFile.

Share this post


Link to post
Share on other sites
JPEGs don't contain animations.

You can, however, load a couple of JPEG files into different textures and just display them in order.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Are you sure? I just made a jpeg animation with photoshop.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OOOO, well is there any way I can use that in Directx?

Share this post


Link to post
Share on other sites
Nope. You will have to do that manually, which isn't that hard to do.
You just create your animation as usual and either save the frames to single images (easier to do that first) or assemble them into a single image layout into rows and columns of single frames.
In your game you load this image (or the the single images) along with extra information about time to next frame (or just a single frame-rate).
In your render loop you would then get the time that elapsed since the last frame and add that to an animation timer. If this timer equals or exceeds your animation frame rate you would switch to the next image and reset your animation timer to zero.
The last frame of animation has then to be treated in a special way, e.g. keeping it for one-shot animations or simply setting the animation frame counter back to zero for loops, etc. - you'll figure that out once you get started with it.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!