• Advertisement
Sign in to follow this  

Error creating texture

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

I'm trying to draw a texture in directX but this line keeps returning false, id it possible that my graphics card or an uninstalled DLL is the cause of this?
// create texture 
BOOL Window_main::CreateTexture() 
{ 
 if(FAILED(D3DXCreateTextureFromFile(pointer_deviced3d,"Image2.bmp", &pointer_texture))) 
  return FALSE;   
}   


in case it matters : Image2 is a 4 KB large Bitmap Image in the section where my all my source code's and headers can be found.

Share this post


Link to post
Share on other sites
Advertisement
Two things immediately spring to mind.

1) The image has to be in the application's current working directory. That isn't necessarily the same as your source folder. If you're using Visual C++ then check in the project properties, in the debug section and there's a box to change the start folder when debugging.

2) Your graphics card doesn't support images of that size (although, if it's fairly recent then it should). Run the DXCapsViewer tool and it's listed in the "D3D Device Types/HAL/Caps" section.

HTH.

Share this post


Link to post
Share on other sites
Is that the *entire* function?

If so, is there any *particular* reason you would expect it to return TRUE if the D3DXCreateTextureFromFile succeeded? If it does, you reach the end of the function without explicitly returning anything. :\

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
Is that the *entire* function?

If so, is there any *particular* reason you would expect it to return TRUE if the D3DXCreateTextureFromFile succeeded? If it does, you reach the end of the function without explicitly returning anything. :\

Save time writing brackets, lose time debugging the resulting bugs ;).

If it is the whole function, his code should not even compile, the function has to return a bool value, while it only does when the statement is true.

Share this post


Link to post
Share on other sites
The function is part of a larger that stops running once one of its inner functions returns false

Share this post


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

  • Advertisement