Skip to main content
gamedev.net
🔒 Locked

Effect::Begin

Started by wforl Mar 26, 2009 at 7:44 PM 1 replies 800+ views
Original Post
wforl
wforl
From reading the documentation, this call is suppose to store effect states at Begin and restore at end. So ALPHATESTENABLE should get set back to false, IF it was false before ::Begin. And the same for the D3DRS_ALPHAREF, it gets set with the original at the end. Concerning the following, it doesnt seem to restore the ALPHATESTENABLE state back to false, i have to add the commented bit at the end. So im guessing the state was already set before the call. But i cant find this anywhere in my code. Basically i just want to clarify that my understanding is correct.

m_FX->SetTechnique(this->m_hTech1);
m_FX->Begin(0, 0);

	HR(m_D3dDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x00000999));
	HR(m_D3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true));
	HR(m_D3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL));

        m_FX->BeginPass(0);

        //render stuff
							
        m_FX->EndPass();
m_FX->End();

//HR(m_D3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, false));

Promit
Promit
You could just call GetRenderState and see what comes back...
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
jpventoso
jpventoso
From the SDK docs:

"
(...)
Flags

DWORD that determines if state modified by an effect is saved and restored. The default value 0 specifies that Begin and End will save and restore all state modified by the effect (including pixel and vertex shader constants). Valid flags can be seen at Effect State Save and Restore Flags (...)
"

I think the effect restores the state from modifications applied only by the effect and doesn't restore other states, so I think the solution is to set those states in the technique declaration.

HTH. Cheers,

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.