Jump to content

  • Log In with Google      Sign In   
  • Create Account


Huge .fx confusion? ;(


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Vio Lence   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 January 2012 - 01:41 PM

So I basically started writing an engine for a 3d game,I was new to DirectX,but I'm a quick learner,so far I've got down the camera system,a model class,a sprite class(for corsairs moving on screen and stuff) and some input/output functions to read .x files.The real surprise was when I tried to load .fx files.I mean I'm not sure I'm getting this...the other stuff works flawlessly,but when I load a fx file with the code from any tutoria,it crashes.The debugger says the problem is here:
iPass = 0;
    cPasses = passes;
D3DXCreateEffectFromFile(m_d3dDevice,path,NULL,NULL,0,	 NULL,&anEffect,NULL);
[color=#ff0000]this->anEffect->FindNextValidTechnique(NULL,&hTech);[/color]
they are a part of the model class and without the fx code,it all works properly,this is the tutorial that i read about fx files from: http://www.toymaker.info/Games/html/effects_files.html

also when I open an example solution from the SDK and i replace the example .fx in it with another .fx(i've tried replacing it with ones I downloaded as well as ones I made with FX Composer) and it too crashes.Is there some other source where I can learn about using .fx files?I never imagined that would be the hardest part of the 3d engine. Posted Image

Sponsor:

#2 MJP   Moderators   -  Reputation: 10117

Like
0Likes
Like

Posted 15 January 2012 - 02:15 PM

You're not checking the return code of D3DXCreateEffectFromFile. It's probably failing, which means the effect pointer will be NULL and your program will crash when you try to access it. You should check the error code, and if it fails check the ppCompilationErrors pointer for a buffer containing compilation errors. You can also turn on the debug runtimes to get additional information on why a function call failed.

#3 Vio Lence   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 January 2012 - 02:48 PM

You're not checking the return code of D3DXCreateEffectFromFile. It's probably failing, which means the effect pointer will be NULL and your program will crash when you try to access it. You should check the error code, and if it fails check the ppCompilationErrors pointer for a buffer containing compilation errors. You can also turn on the debug runtimes to get additional information on why a function call failed.

You're not checking the return code of D3DXCreateEffectFromFile. It's probably failing, which means the effect pointer will be NULL and your program will crash when you try to access it. You should check the error code, and if it fails check the ppCompilationErrors pointer for a buffer containing compilation errors. You can also turn on the debug runtimes to get additional information on why a function call failed.


do you think it's a good idea to make of it some sort of Effect class and simplify it into Load/Unload/Render methods? Q_Q or do different effects require too much specific operations?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS