Jump to content
  • Advertisement
Sign in to follow this  
shultays

problem about D3DXCreateEffectFromFile

This topic is 3317 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 some problems about shaders. when I use this D3DXCreateEffectFromFile( D3DDevice, "Ambient.fx", NULL, NULL, NULL, NULL, &AmbientEffect, NULL); It sets AmbientEffect to NULL and after that it gives exception when it tries to use AmbientEffect. Why is this hapenning? I am using this example http://www.applicachia.com/HLSLAmbientLighting.zip .exe file works fine but I can't compile and run the source file. In one forum people says try to compile .fx file using fxc.exe (in directx sdk utilities folder) but it works fine. I could manage to use the assembly output of fxc.exe in a ps file and it worked fine. I am using visual studio 2008. All another directx examples works fine.Maybe I should configure something in visual studio in order to use HLSL? I copied bin and include directories of directx sdk but nothing else.

Share this post


Link to post
Share on other sites
Advertisement
What is the return value of the function? Also make sure you check the string contained in the ID3DXBuffer return by the ppCompilationErrors parameter, and run with the debug runtimes active.

Share this post


Link to post
Share on other sites
First thing to notice in the example code is that there is no result check. Something like
HRESULT hres = D3DXCreateEffectFromFile( D3DDevice, "Ambient.fx", NULL, NULL, NULL, NULL, &AmbientEffect, NULL );
if(FAILED(hres)) do_something_about_it();


That would tell you the result is E_NOTIMPL. Googling "D3DXCreateEffectFromFile E_NOTIMPL" would bring you back in time, in this forum.

So you can enable backward compatibility, or (what I've done) modify the fx file to compile your ps using ps_2_0 version. Then it works fine.

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!