Page 1 of 1

CEGUI messing with my textures

Posted: Fri May 09, 2008 20:04
by MrDoom
It seems that when I render CEGUI, the textures on my terrain no longer render.

Without CEGUI:
Image

With CEGUI:
Image

The only difference between those two screenshots is that I am running a call to render CEGUI after I have rendered everything else in my scene and before I call EndScene and Present on D3D. Everything else is the same.

Anyone know what might cause this?

EDIT
It also seems to be messing with my alpha, since when the GUI is rendering, I can see through my terrain like it's partially transparent.

Posted: Sat May 10, 2008 08:24
by CrazyEddie
For performance reasons we do not save and restore the D3D state - so after rendering CEGUI the render states will be in whatever state the CEGUI renderer left them in. If restoring individual states is an issue, you may need to make the appropriate calls to record the D3D state before rendering CEGUI, then restore those states after rendering CEGUI. I can't remember off what those D3D interface names are called, but I know they exist :)

CE.

Posted: Sat May 10, 2008 13:56
by MrDoom
Yeah, you can make a State Block. This works now:

Code: Select all

// Get the device's current states.
LPDIRECT3DSTATEBLOCK9 sb = NULL;
d3dDevice9->CreateStateBlock(D3DSBT_ALL, &sb);

// Render the GUI.
CEGUI::System::getSingletonPtr()->renderGUI();

// Clean anything that CEGUI might have messed with.
if(sb)
{
   sb->Apply();
   sb->Release();
}