Original Post
Hi all, I'm trying to integrate effects files in my engine. What I'm doing is: a)every time a effect is loaded I compile it and store the ID3DXEffect generated as template in my resource map. b)every time a new object requires the same effect, I clone the template and store into the engine object instance. The problem is that every time I try to call ID3DXEffect::Begin() in the cloned object, I have a crash in the D3DX runtime dll. If I use the original effect returned by D3DXCreateEffect() everything works properly. Is there anything special I have to do to have a working cloned effect? right now I'm not trying to share any parameter. basically I do:
D3DXCreateEffect(...,&pTemplate)
//store the pointer in my resource map
...when I want a new instance
pTemplate->CloneEffect(pEffect);
//pass the template to the obejct instance
... in the rendering loop
pEffect->Begin(&passes,0); //crash here !!!!
pEffect->Pass(n);
pEffect->End();
ciao Alberto