Game Development Community

Mismatching render states

by Kevin Johnson · in Torque Game Engine Advanced · 08/14/2006 (8:13 pm) · 2 replies

While porting fxLight over to tse (mostly just for learning exp)

Ive got it in and working...BUT the canonizer says
(when i move the light and camera outside the orcbase)

fxLight::renderObject: Mismatching render state #3: 1 != 0
fxLight::renderObject: Mismatching render state #4: 0 != 1
fxLight::renderObject: Mismatching render state #13: 0 != 1

looking at the the enums
enum GFXRenderState 
{
   GFXRenderState_FIRST = 0,
   GFXRSZEnable = 0,
   GFXRSFillMode,
   GFXRSShadeMode,
   GFXRSZWriteEnable,
   GFXRSAlphaTestEnable,
  ...   
   GFXRSAlphaBlendEnable,
 ...  
   GFXRenderState_COUNT          ///< Don't use this one, this is a counter
};


i would assume its :
GFXRSZWriteEnable,
   GFXRSAlphaTestEnable,
   GFXRSAlphaBlendEnable


but doesnt this block of code do that??:
GFX->setZWriteEnable( true );
   GFX->setAlphaTestEnable( false );
   GFX->setAlphaBlendEnable( false );
   GFX->popWorldMatrix();
   GFX->popState();

or am i a complete idiot??

k




update



i decided to go brute force with it (inside ::renderObject)

U32 ZWriteState = GFX->getRenderState(3);
 U32 AlphaTestState= GFX->getRenderState(4);
 U32 AlphaBlendState = GFX->getRenderState(13);


...


   //clean up
   GFX->setZWriteEnable( ZWriteState);
   GFX->setAlphaTestEnable(AlphaTestState);
   GFX->setAlphaBlendEnable( AlphaBlendState );


same results..It works fine inside the orcbase..If I comment out my cannonizer it blows up in terrRender::renderblock with the same states bonkered..

#1
08/15/2006 (1:41 pm)
Uhh, yeah, just ignore the canonizer, just remove it from the code. It's not so necessary anymore now that we have proper state management in. Just make sure you don't leave any crazy states on when you leave the render function. You can also use GFX->pushState() and GFX->popState() to be sure you aren't messing up global state.
#2
08/16/2006 (5:43 pm)
Ok I think i got it . i was leaving some "crazy states" around...

.thanx