Sign in to follow this  
Sylvarant

Error creating texture

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

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