Jump to content

  • Log In with Google      Sign In   
  • Create Account


Create texture failing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 15 January 2014 - 04:28 AM

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 :)



Sponsor:

#2 C0lumbo   Crossbones+   -  Reputation: 2120

Like
0Likes
Like

Posted 15 January 2014 - 12:41 PM

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, 15 January 2014 - 12:42 PM.


#3 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 15 January 2014 - 03:02 PM

Thanks for the reply, but yes I am using the latter (D:\\sprite.png)

#4 greenpig83   Members   -  Reputation: 323

Like
1Likes
Like

Posted 15 January 2014 - 07:20 PM

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: http://stackoverflow.com/questions/18613229/loading-textures-in-directx

#5 DarkRonin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 15 January 2014 - 07:52 PM

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: http://stackoverflow.com/questions/18613229/loading-textures-in-directx

 

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!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS