Sign in to follow this  

texture loading problem

Recommended Posts

When I try to load and set a texture on a 3d square, the square comes out white. I put the texture into the project folder so that it should find it but no matter where i put it it keeps coming out white. Anyone know the problem?

Share this post

Link to post
Share on other sites
Original post by sirob
Are you using the Debug Runtimes?
That's my line [smile]

As sirob implied, it sounds like the texture isn't loading at all, which is giving you a NULL texture pointer, which you're then assigning to the device, which is having the same effect as having no texture applied at all. And assuming you have a white material set up, you'd just get a white quad.

You should be checking the return values for all important D3D and D3DX functions, where "important" is defined as "returns a pointer or fills some structure with information that you later rely on". In this case, D3DXLoadTextureFromFile, or whatever function you're using returns a pointer indirectly, and you should always make sure this function succeeds (with the SUCCEEDED or FAILED macros).
Another alternative is that you're loading the texture into a memory pool that the device can't access, such as D3DPOOL_SYSTEMEM or D3DPOOL_SCRATCH.
And another possibility is that your loading code is wrong. It's really impossible to say without some code.

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