Jump to content
  • Advertisement
Sign in to follow this  
Vio Lence

D3DXCreateEffectFromFile error?

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

For some reason I keep getting an error when I try to load an fx file in my Effect class,here is the loader function



HRESULT CFXFileEntity::Load(std::string path)
{
HRESULT hr;

if (FAILED(hr=D3DXCreateEffectFromFile(m_d3dDevice,path.c_str(),NULL,NULL,0,NULL,&anEffect,NULL)))
return hr;

if (FAILED(hr=anEffect->FindNextValidTechnique(NULL,&hTech)))
return hr;
}


it doesn't return any hr value(???) and it crashes at this line:

if (FAILED(hr=D3DXCreateEffectFromFile(m_d3dDevice,path.c_str(),NULL,NULL,0,NULL,&anEffect,NULL)))
I've tried different simple fx files,both from RenderMonkey and from FX Composer and it always crashes,debug says the error code is


Unhandled exception at 0x546d1ea8 in GAME.exe: 0xC0000005: Access violation reading location 0xcccccccc.[/quote]

what could be causing this?

Share this post


Link to post
Share on other sites
Advertisement
I'm guessing m_d3dDevice is equal to 0xcccccccc because CreateDevice() failed.

Enabling the debug runtimes in the control panel that came with the SDK should tell you exactly what's wrong.

Share this post


Link to post
Share on other sites
This is why you always initialise your variables. As Adam_42 said, your m_d3dDevice pointer is invalid (Never intitialised). I don't think even the debug runtimes would catch that particular error since it's a hard crash.

The other possibility is that anEffect is the first member of the class and your CFXFileEntity class instance isn't initialised, such as in:

CFXFileEntity* foo;
foo->Load("Thingmy");

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!