Huge .fx confusion? ;(

Started by
1 comment, last by Vio Lence 12 years, 3 months ago
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);

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. mellow.png
Advertisement
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.

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?

This topic is closed to new replies.

Advertisement