hi,
It is said that we need to recover the render state after rendering cegui , because cegui will change some of the render state.
Is it true? Is there a better way to do it rather than guess what should be recovered?
Now my problem is, I'm trying to draw a line on screen to show current direction. I give it a color that is 0xffff0000 which should be red.
However, if I render CEGUI at the same time ,the line will always be WHITE~
If I STOP render CEGUI, the line becomes red, that is WHAT I WANT.
I guess CEGUI may change a render state which will effect this. my current function to recover render state from cegui is:
(And please try to consider the simplest way of the whole render process, in fact I really just draw a line)
{
LPDIRECT3DDEVICE9 pDevice = m_pRenderer->getDevice();
pDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetTextureStageState( 0 , D3DTSS_COLORARG1, D3DTA_TEXTURE );
pDevice->SetTextureStageState( 0 , D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pDevice->SetTextureStageState( 0 , D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
pDevice->SetFVF(NULL);
}
Any reply will be helpful
I...Just need a colorful line...
Moderators: CEGUI MVP, CEGUI Team
Re: I...Just need a colorful line...
Hi all,
I just figure out , We need to set pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE); to restore the render state
I just figure out , We need to set pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE); to restore the render state
Who is online
Users browsing this forum: No registered users and 3 guests