Sign in to follow this  
load_bitmap_file

D3DXLoadSurfaceFromFile - GIFs

Recommended Posts

According to the documentation, D3DXLoadSurfaceFromFile doesn't support .gif files. However, I forgot this and loaded a gif file for a cursor image, and it displayed correctly anyway. I'm not sure how this would happen successfully unless there was gif loading code somewhere in the function. Did the DX team forget to mention that the D3DXLoadSurfaceFromFile supports gifs in the docs?

Share this post


Link to post
Share on other sites
Antheus    2409
It could be an undocumented feature, there's plenty of them in any MS code.

While it works, it simply adds risk to the project, since support may be removed or changed completely at some later point. It might also not be available in older versions.

Share this post


Link to post
Share on other sites
Ah, darned undocumented features. [smile]

I think I'm going to continue to allow the use of GIFs, even if it's probably a bad idea. I'm using the last non-DX10 stuff version of the DX9 SDK and if I ever update and rewrite my code to use DX10 a ton of changes would have to be made anyway.

Thanks!

Share this post


Link to post
Share on other sites
Mastaba    761
Direct3D 10 adds support for GIF and TIFF files, and so perhaps that is working because of that (assuming Direct3D 10 and Direct3D 9 have some code in common).

Share this post


Link to post
Share on other sites
Quote:
Original post by Mastaba
Direct3D 10 adds support for GIF and TIFF files, and so perhaps that is working because of that (assuming Direct3D 10 and Direct3D 9 have some code in common).


I'm using the October 2005 SDK, the last one I could find before they added the D3D10 stuff. Maybe they simply added the fact that you could load GIFs in the docs. [smile]

Share this post


Link to post
Share on other sites
Jonas B    100
Note also that .NET's System.Drawing.Image.FromFile handles animated GIFs as well. It's very easy to build a tileset texture from the individual frames by using image.SelectActiveFrame().

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Interesting!

If you've got a simple repro case you could fire it off to MS... Theres the 'Feedback? Please provide us with your comments on this topic.' link at the bottom of the page, and you could also CC directx@microsoft.com.

I would imagine there are 2 cases:

1. there was some prototype code at some point, but hasn't been removed (maybe it never worked properly)

2. it's a documentation error - maybe it got added to the code, but they didn't update the doc pages...

Jack

Share this post


Link to post
Share on other sites
Evil Steve    2017
There's another possibility - Is the file definitely a .gif? Are the first 3 bytes of the file "GIF"? It's possible that the file is actually a bitmap or something, with jus the extension changed to .gif...

Share this post


Link to post
Share on other sites
ET3D    810
My guess is that GIF had been taken out, perhaps even at doc level only, because of the patent. The patent expired in 2003, but it's possible that the docs haven't been updated to reflect this.

Share this post


Link to post
Share on other sites
circlesoft    1178
Quote:
Original post by ET3D
My guess is that GIF had been taken out, perhaps even at doc level only, because of the patent. The patent expired in 2003, but it's possible that the docs haven't been updated to reflect this.

Yea, this sounds about right. Even then, GIF is far from the most desirable texture format to be using. I usually stick with .png, .tga, or .hdr to avoid any compression artifacts. Yay for shipping on DVDs!

Share this post


Link to post
Share on other sites

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