Sign in to follow this  

D3DXCreateTextureFromFile() Crashes...

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

D3DXCreateTextureFromFile() crashes my program. What am I doing wrong? I pass a valid device object, filename and texture reference. I know the device is vaild because I use it just before I attempt to load the texture. I'm using DirectX 8.

D3DXCreateTextureFromFile(pDevice, "test.bmp", &pTexture);


Share this post


Link to post
Share on other sites
The function crashes my program (I get a access violation error), so no, it does not return a HRESULT.

I've tried setting the texture to NULL before loading, but the same thing happens in both cases.

Share this post


Link to post
Share on other sites
um...that's wierd. Linking to the debug lib fixed the problem...but I noticed that I had linked the d3dx9.lib and i'm using d3d8...so it might have been because I used mixed versions of the libs?

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkZoulz
um...that's wierd. Linking to the debug lib fixed the problem...but I noticed that I had linked the d3dx9.lib and i'm using d3d8...so it might have been because I used mixed versions of the libs?


Is the debug build only working? In debug mode the variables are automatically initialized. You should check if you initialize your texture variable (NULL) before passing it to the D3DXCreateTextureFromFile() method. After that your release build should also work.

Share this post


Link to post
Share on other sites

This topic is 4857 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.

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