Archived

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

How to display gif image in DirectX

This topic is 5147 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, Please tell how to display a gif/jpeg images in direct3D.Is it different from displaying a bitmap image. if so pls tell me what is the difference & wat I've to do to display a gif image [edited by - anandhir on November 10, 2003 6:43:34 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by anandhir
Hi all,
Please tell how to display a gif/jpeg images in direct3D.Is it different from displaying a bitmap image. if so pls tell me what is the difference & wat I''ve to do to display a gif image



[edited by - anandhir on November 10, 2003 6:43:34 AM]


To load .bmp, .dds, .dib, .jpg, .png, and .tga files you can use the D3DX utility library. That contains functions such as D3DXCreateTextureFromFile(). Once the texture is loaded you can apply it to polygons as you require.

Take a look at Tut05_Textures in the \DXSDK\Samples\C++\Direct3D\Tutorials\ folder for an example of this.


GIF files are slightly more difficult for a few reasons:

1) The LZW compression they use is still patented in some countries so you need to pay a license fee to use that format.

2) There is code out on the internet to read and decode GIF files into an array in memory - however you''ll have to manually create the surface/texture in D3D, lock that, handle format conversions and write the image data into the texture pixel by pixel.

Use PNG instead - it''s far superior.


--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post


Link to post
Share on other sites