Jump to content
  • Advertisement
Sign in to follow this  
phtsai63

Effect SetTechnique Error

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

It is about passing effect handle to set the technique. Two techniques "T0" and "T1" in the effect file (.fx). Two class: class A { ID3DXEffect* m_pEffectA; HRESULT CreateEffect(); }; class B { ID3DXEffect* m_pEffectB; HRESULT Render(ID3DXEffect* m_pEffectC); }; HRESULT A::CreateEffect() { D3DXHANDLE hT0; D3DXCreateEffectFromFile(pd3dDevice, ..., &m_pEffectA, NULL ); hT0 = m_pEffectA->GetTechniqueByName("T0"); V_RETURN(m_pEffectA->ValidateTechnique(hT0)); m_pEffectA->setTechnique(hT0); } HRESULT B::Render(ID3DXEffect* m_pEffectC) { D3DXHANDLE hT0, hT1; hT0 = m_pEffectA->GetTechniqueByName("T0"); hT1 = m_pEffectA->GetTechniqueByName("T1"); V_RETURN(m_pEffectA->ValidateTechnique(hT0)); //D3DERR_CONFLICTINGRENDERSTATE V_RETURN(m_pEffectA->ValidateTechnique(hT1)); m_pEffectA->setTechnique(hT1); ... } main() { A cA; B cB; ... cB.Render(cA.m_pEffectA); } It generate error at the comment(//D3DERR_CONFLICTINGRENDERSTATE). Could anyone help me to figure out this error. Thx.

Share this post


Link to post
Share on other sites
Advertisement
your m_pEffectA is not initilized. That pointer could point to anything in memory, which leeds to error.

You should in main write:



main()
{
A cA;
B cB;
cA.CreateEffect();
cB.Render(cA.m_pEffectA);
}


Share this post


Link to post
Share on other sites
Thanks your point.
These codes are just abbreviation version.
I have initialize before cB.Render(cA.m_pEffectA);.

Share this post


Link to post
Share on other sites
please post the fx file, it is correct?
take a look at the theqniuqe called T0 as it looks like the errors comes from there

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!