Jump to content
  • Advertisement
Sign in to follow this  

loading texture from x file!

This topic is 3082 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 have successfully loaded a mesh from an X file and rendered it but I'm having a problem with its texture:
void loadObject ( void )

	D3DXLoadMeshFromX (

	D3DXMATERIAL* matMaterials = (D3DXMATERIAL*)pAlienMtBuff->GetBufferPointer();
	pAlienMats = new D3DMATERIAL9[numMats];
	for (DWORD i = 0 ; i < numMats ; i++)
		pAlienMats = matMaterials.MatD3D;
		pAlienMats.Ambient = pAlienMats.Diffuse;
	//Using 1 for now as theres only 1 texture
	D3DXCreateTextureFromFileA( pd3dDevice, matMaterials[1].pTextureFilename, &pTexture);


When I make a break after the create texture it shows that the texture filename is "Mutant01_D2.tga" although the image file that came with the model is "Mutant01_D2.dds". Also just after the call to createTexture I'm getting this error message: Unhandled exception at 0x7c901278 in d3dtut.exe: 0xC0000005: Access violation reading location 0xfeeefeee. How would I go about getting the correct texture name and so on and anyone know why I'd be getting that error?? Thanks, Malb. Edit: 0xfeeefeee seems to be the location of matMaterials[1].pTextureFilename

Share this post

Link to post
Share on other sites
Changing the 1 to a 0 seems to get rid of the error but the texture still isn't showing on the model, I'm guessing it's because the x file thinks the texture should be "Mutant01_D2.tga" although the model loads using DarkGDK without having to apply the texture myself.

How would I go about doing that???

Share this post

Link to post
Share on other sites
Did you use panda exporter for the .X file. if so then when in 3dsmax check to see if you have more then 1 material in the materials list if so, panda will export all texture and put them in the .X file if used or not used.
that is where the tga may come from.
Hope this give some light into the problem your having.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!