Game Development Reference
In-Depth Information
2.
The following is the C++ code to render the background:
LGL3->glDisable( GL_DEPTH_TEST );
3.
First, bind 3 textures and the shader:
BackTexture_Bottom->Bind(2);
BackTexture_Top->Bind(1);
BackTexture->Bind(0);
BackShader->Bind();
4. Update the pressed lags of control buttons:
BackShader->SetUniformNameFloatArray( "b_MoveLeft", 1,
b_Flags[b_MoveLeft] );
BackShader->SetUniformNameFloatArray( "b_Down", 1,
b_Flags[b_Down] );
BackShader->SetUniformNameFloatArray( "b_MoveRight", 1,
b_Flags[b_MoveRight] );
BackShader->SetUniformNameFloatArray( "b_TurnLeft", 1,
b_Flags[b_TurnLeft] );
BackShader->SetUniformNameFloatArray( "b_TurnRight", 1,
b_Flags[b_TurnRight] );
BackShader->SetUniformNameFloatArray( "b_Reset", 1,
b_Flags[b_Reset] );
BackShader->SetUniformNameFloatArray( "b_Paused", 1,
b_Flags[b_Paused] );
5.
Finally, render a full-screen rectangle:
Canvas->GetFullscreenRect()->Draw(false);
6.
The float b_Flags[] array corresponds to the state of control buttons; the value
of 1.0f means the button is pressed and 0.0f means it is released. These values
are passed to the shader to highlight buttons accordingly.
 
Search WWH ::




Custom Search