Advertisement Jump to content
Sign in to follow this  

Create texture failing

This topic is 1828 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 Guys,


This is probably a stupid one that is staring me in the face.


But, I am failing to create a texture from file


IDirect3DTexture9 *pTexture=NULL;
HRESULT error=D3DXCreateTextureFromFile(d3ddev,"sprite.png",&pTexture);


d3ddev is valid at this point because I can remove the above calls and the scene renders fine.


I have tried the sprite.png file in the same location of the exe file and even hard coded the file to be called from D:\sprite.png.


But, each time HRESULT returns D3DERR_INVALIDCALL


Any help on this would be absolutely awesome :)

Share this post

Link to post
Share on other sites

When you tried "D:\sprite.png" did you actually have "D:\sprite.png" in the code? That might have failed because you need to use "D:\\sprite.png" instead for the backslash to work properly.

Edited by C0lumbo

Share this post

Link to post
Share on other sites

You should know to enable directx debug mode. Install directx sdk, run its config there is option for debug, break when directx error! Later there will be errors that hard to findout without debug mode help!
This post answer how to open debug mode:


Actually, I just did that an hour ago. :)


I since found that I 'broke' the device creation during some late night coding. I somehow managed to set the backbuffer dimensions to zero.


Just goes to prove, once you have coded for so many hours straight the productivity curve starts going into the negative.


Thanks guys!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!