bool OGL2_Renderer::Init() { if( glewInit() != GLEW_OK ) { PRINTF( "Failed to initialize GLEW\n" ); return false; } glEnable( GL_CULL_FACE ); glEnable( GL_ALPHA_TEST ); glEnable( GL_TEXTURE_2D ); memset( &rconf, 1, sizeof( rconf ) ); currentTexture = 123123; rconf.flags = 0; rconf.blendEnabled = true; // just to turn it off SetCulling( 0 ); SetCulling( CULL_FRONT ); SetDepthTest( DEPTH_DISABLED ); SetDepthTest( DEPTH_LESS_EQUAL ); SetAlphaTest( 0 ); SetAlphaTest( 1 ); SetAlphaTest( 0 ); SetBlending( 0, 0 ); SetBlending( BLEND_ONE, BLEND_ONE ); SetBlending( 0, 0 ); // glEnable( GL_DEPTH_TEST ); // glDepthFunc( GL_LEQUAL ); p_MainShader = PrecacheShader( "main" ); p_MenuBgShader = PrecacheShader( "menubg" ); PrecacheImage( "bear", 1024, 512, false ); PrecacheImage( "pipe", 256, 128, false ); PrecacheImage( "grass", 1024, 512, false ); PrecacheImage( "dirt", 512, 512, false ); PrecacheImage( "finish", 512, 256, false ); PrecacheModel( "pipe_1" ); PrecacheModel( "pipe_2" ); PrecacheModel( "pipe_3" ); PrecacheModel( "pipe_4" ); PrecacheModel( "pipe_5" ); PrecacheModel( "pipe_6" ); PrecacheModel( "finish" ); PrecacheModel( "bear" ); PrecacheModel( "terrain" ); p_Ortho->Init(); return true; }
void RageDisplay::SetDefaultRenderStates() { SetLighting( false ); SetCullMode( CULL_NONE ); SetZWrite( false ); SetZTestMode( ZTEST_OFF ); SetAlphaTest( true ); SetBlendMode( BLEND_NORMAL ); SetTextureFiltering( TextureUnit_1, true ); SetZBias( 0 ); LoadMenuPerspective( 0, 640, 480, 320, 240 ); // 0 FOV = ortho }
void RageDisplay::SetDefaultRenderStates() { SetLighting( false ); SetCullMode( CULL_NONE ); SetZWrite( false ); SetZTestMode( ZTEST_OFF ); SetAlphaTest( true ); SetBlendMode( BLEND_NORMAL ); SetTextureFiltering( true ); LoadMenuPerspective(0, SCREEN_CENTER_X, SCREEN_CENTER_Y); // 0 FOV = ortho ChangeCentering(0,0,0,0); }
void GLRenderState::Bind() { SetBlend(srcBlend, dstBlend); SetBlendFunc(blendFunc); SetAlphaTest(alphaTest, alphaRef); SetCull(cullMode); SetDepthTest(depthTest); SetDepthWrite(depthWrite); /* if(!curState) { curState = this; return; } if(curState->GetSrcBlend() != srcBlend || curState->GetDstBlend() != dstBlend) { SetBlend(srcBlend, dstBlend); } if(curState->GetBlendFunc() != blendFunc) { SetBlendFunc(blendFunc); } if(curState->GetAlphaTest() != alphaTest || curState->GetAlphaRef() != alphaRef) { SetAlphaTest(alphaTest, alphaRef); } if(curState->GetDepthTest() != depthTest) { SetDepthTest(depthTest); } if(curState->GetDepthWrite() != depthWrite) { SetDepthWrite(depthWrite); } if(curState->GetCullMode() != cullMode) { SetCull(cullMode); } */ curState = this; }