D3DERR_INVALIDCALL when creating texture
I started to work with HLSL and when I got to make it able to render textures I noticed I can't load a the textures. I haven't changed anything in the code to load and store the texture, at all. I even have an old version saved and used that but it didn't work. I get D3DERR_INVALIDCALL when using:
D3DXCreateTextureFromFileA(pD3DDev, tempMaterials.pTextureFilename, &texture)
texture is defined as: texture = new LPDIRECT3DTEXTURE9[matCount]; with matCount being the correct number.
pD3DDev = LPDIRECT3DDEVICE9 pD3DDev;
tempMaterials = D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)tempBufMaterial->GetBufferPointer();
Where tempBufMaterial is created from a successful D3DXLoadMeshFromX();
I am absolutely clueless, the .bmp files are in the right places too, I can open the mesh with dxviewer and the textures work.
It sounds ridiculous but I can't find the debug tab with any check box. I can find "Debugging" under "Configuration Properties" to the left but there are no check boxes and nothing about unmanaged code debugging.
Then I think it's safe to assume that the filename is invalid. What is tempMaterials.pTextureFilename? What if you print it out?
Quote:Original post by HannesnisulaAnd that file exists on the current path? I.e. in the same directory as the mesh?
tempMaterials.pTextureFilename is "bihull.bmp" which is the correct name.
And you're sure that the error is coming from that function (Put a breakpoint on it and step over it)?
Yes the error is comming from that function. And strangely enough, yes they're in the same folder. If some "default" folder or w/e is set in my project (which I don't know about) it should work anyway because my mesh and pictures are in the same folders everywhere I've got a version of it.
EDIT: I tried with another mesh + texture and that worked. I'm still very confused why the other didn't work, it works with earlier versions of my program.
EDIT: I tried with another mesh + texture and that worked. I'm still very confused why the other didn't work, it works with earlier versions of my program.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement