View Full Version : DirectX: Loading textures from disk
VengefulPastry
01-06-2005, 08:14 PM
I've decided to learn C++. Having come from a Visual Basic/DirectX background, I got used to loading textures from the disk using the "CreateTextureFromFileEx" command.... which was very useful for setting parameters like memory usage and stencil/mask colors...
...unfortunately, C++ DirectX seems not to have a similar command. Does anybody know how to load a texture from disk in C++/DirectX that allows you to program in the extra parameters directly?
Thanks!
Ferdi
01-06-2005, 09:54 PM
Hi,
I believe the function you looking for is D3DXCreateTextureFromFileEx. I guess you just have to stick D3DX infront of the function to covert from VB to C++. Also don't forget to include d3dx8.h or d3dx9.h depending on which version of directx you are using.
Cheers
Ferdi
VengefulPastry
01-07-2005, 06:43 AM
That was it!
I couldn't find documentation for "d3dxcreatetexturefromfileex" in the DX9 SDK, so I just assumed it wasn't included. That will teach me to assume.
I plugged it in, and the compiler automated adding about 10 extra .cpp and .h files that allowed me to use the texture loader utility.
Thanks Ferdi!
C_Coder
01-07-2005, 10:03 AM
The D3DX library is a very good addition to the DirectX SDK. It saves a lot of time doing common stuff!
wazoo
01-07-2005, 10:52 AM
D3DX is what keeps me from using...the "Other" graphics API. :)
C_Coder
01-07-2005, 11:20 AM
D3DX is what keeps me from using...the "Other" graphics API. :)
How true! :D
@VengefulPastry: Are you going to use DX9 for your idie games? That SDK would be only installed at hardcore gamers and not all cards support DX9. I suggest DX7 or DX8(.1).
VengefulPastry
01-07-2005, 01:05 PM
Hmmmm, good point C_Coder.....
Any idea where to get a copy of the 8.0 SDK? And....I'm on dial-up....
gmcbay
01-07-2005, 01:17 PM
You can develop DX8 (or any previous version) apps using the DX9 SDK (I am doing this currently, and it works perfectly fine).
Just #define DIRECT3D_VERSION to 0x0800 before you include any DX headers. Similar defines exist for the other bits & bobs of DirectX (DSound, etc).
C_Coder
01-08-2005, 05:45 AM
Use Direct3DCreate8 to create an IDirect3D8 interface and IDirect3D8::CreateDevice to create an IDirect3DDevice8 interface.
I do not set that #define to use DX8 since there are these interfaces directly.
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.