Пример #1
0
// Create and return a StateSet appropriate for performing an occlusion
//   query test (disable lighting, texture mapping, etc). Probably some
//   room for improvement here. Could disable shaders, for example.
StateSet* initOQState()
{
    StateSet* state = new StateSet;
    // TBD Possible bug, need to allow user to set render bin number.
    state->setRenderBinDetails( 9, "RenderBin" );

    state->setMode( GL_LIGHTING, StateAttribute::OFF | StateAttribute::PROTECTED);
    state->setTextureMode( 0, GL_TEXTURE_2D, StateAttribute::OFF | StateAttribute::PROTECTED);
    state->setMode( GL_CULL_FACE, StateAttribute::ON | StateAttribute::PROTECTED);

    ColorMask* cm = new ColorMask( false, false, false, false );
    state->setAttributeAndModes( cm, StateAttribute::ON | StateAttribute::PROTECTED);

    Depth* d = new Depth( Depth::LEQUAL, 0.f, 1.f, false );
    state->setAttributeAndModes( d, StateAttribute::ON | StateAttribute::PROTECTED);

    PolygonMode* pm = new PolygonMode( PolygonMode::FRONT_AND_BACK, PolygonMode::FILL );
    state->setAttributeAndModes( pm, StateAttribute::ON | StateAttribute::PROTECTED);

    PolygonOffset* po = new PolygonOffset( -1., -1. );
    state->setAttributeAndModes( po, StateAttribute::ON | StateAttribute::PROTECTED);

    return state;
}