Game Development Community

1.8 GFX StateBlock help

by Adam Beer · in Torque Game Engine Advanced · 12/29/2008 (4:50 am) · 0 replies

I am trying to get the TGEA Radar resource working and I added it to 1.8 but get lots of GFX errors. I see that stateBlocks have been added, but I dont understand how to use them. The following blocks of code need to be setup correctly:

GFX->setVertexBuffer( verts );

		GFX->setCullMode( GFXCullNone );
		GFX->setLightingEnable( false );
		GFX->setAlphaBlendEnable( true );
		GFX->setSrcBlend( GFXBlendSrcAlpha );
		GFX->setDestBlend( GFXBlendInvSrcAlpha );
		GFX->setTextureStageAddressModeU(0, GFXAddressWrap);
		GFX->setTextureStageAddressModeV(0, GFXAddressWrap);
		GFX->setTextureStageColorOp( 0, GFXTOPModulate );
		GFX->setTextureStageColorOp( 1, GFXTOPDisable );
		GFX->setTexture( 0, texture );

		GFX->drawPrimitive( GFXTriangleFan, 0, 8);

		GFX->setAlphaBlendEnable( false );

GFX->getDrawUtil()->clearBitmapModulation();

		GFXTextureObject* texture = mCompassTextureObject;

		GFX->setCullMode( GFXCullNone );

		GFX->setLightingEnable( false );
		GFX->setAlphaBlendEnable( true );

		GFX->setSrcBlend( GFXBlendSrcAlpha );
		GFX->setDestBlend( GFXBlendInvSrcAlpha );
		GFX->setTextureStageColorOp( 0, GFXTOPModulate );
		GFX->setTextureStageColorOp( 1, GFXTOPDisable );

		GFX->setTexture( 0, texture );
		GFX->disableShaders();

GFX->setAlphaBlendEnable( false );

If someone could help me out with these new StateBlocks, I would really appreciate it.