本文整理匯總了C++中GL_TextureMode函數的典型用法代碼示例。如果您正苦於以下問題:C++ GL_TextureMode函數的具體用法?C++ GL_TextureMode怎麽用?C++ GL_TextureMode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GL_TextureMode函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
//qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.storedGlState = 0;
glState.faceCulling = CT_TWO_SIDED;
glState.faceCullFront = qtrue;
glState.currentProgram = 0;
qglUseProgramObjectARB(0);
if (glRefConfig.vertexArrayObject)
qglBindVertexArrayARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentVao = NULL;
glState.vertexAttribsEnabled = 0;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
if (glRefConfig.seamlessCubeMap)
qglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// GL_POLYGON_OFFSET_FILL will be glEnable()d when this is used
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); // FIXME: get color of sky
}
示例2: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
// the vertex array is always enabled, but the color and texture
// arrays are enabled and disabled around the compiled vertex array call
qglEnableClientState (GL_VERTEX_ARRAY);
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
qglClearDepth( 1.0 );
qglDrawBuffer( GL_FRONT );
#ifdef IOS
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#else
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#endif
qglDrawBuffer( GL_BACK );
#ifdef IOS
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#else
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#endif
}
示例3: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
//qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.vertexAttribsState = 0;
glState.vertexAttribPointersSet = 0;
glState.currentProgram = 0;
qglUseProgramObjectARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentVBO = NULL;
glState.currentIBO = NULL;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
qglClearDepth( 1.0 );
qglDrawBuffer( GL_FRONT );
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
qglDrawBuffer( GL_BACK );
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
}
示例4: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
// the vertex array is always enabled, but the color and texture
// arrays are enabled and disabled around the compiled vertex array call
qglEnableClientState (GL_VERTEX_ARRAY);
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
#ifdef _NPATCH
// If n-patches are supported, make sure they are disabled for now
// Set the initial tesselation level and the interpolation modes
if ( qglPNTrianglesiATI )
{
qglDisable( GL_PN_TRIANGLES_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_POINT_MODE_ATI, GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_NORMAL_MODE_ATI, GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, 3 );
}
#endif // _NPATCH
}
示例5: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void
GL_SetDefaultState(void)
{
qglClearDepth(1.0f);
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
/* initialize downstream texture unit if we're running
* in a multitexture environment */
if(qglActiveTextureARB){
GL_SelectTexture(1);
GL_TextureMode(r_textureMode->string);
GL_TexEnv(GL_MODULATE);
qglDisable(GL_TEXTURE_2D);
GL_SelectTexture(0);
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode(r_textureMode->string);
GL_TexEnv(GL_MODULATE);
qglShadeModel(GL_SMOOTH);
qglDepthFunc(GL_LEQUAL);
/* the vertex array is always enabled, but the color and texture
* arrays are enabled and disabled around the compiled vertex array call */
qglEnableClientState (GL_VERTEX_ARRAY);
/*
* make sure our GL state vector is set correctly
* */
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.vertexAttribsState = 0;
glState.vertexAttribPointersSet = 0;
glState.currentProgram = 0;
qglUseProgramObjectARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentVBO = NULL;
glState.currentIBO = NULL;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask(GL_TRUE);
qglDisable(GL_DEPTH_TEST);
qglEnable(GL_SCISSOR_TEST);
qglDisable(GL_CULL_FACE);
qglDisable(GL_BLEND);
}
示例6: GL_SetDefaultState
/*
==================
GL_SetDefaultState
==================
*/
void GL_SetDefaultState(void)
{
qglClearDepth(1.0f);
qglCullFace(GL_FRONT);
qglColor4f(1, 1, 1, 1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if (qglActiveTextureARB)
{
GL_SelectTexture(1);
GL_TextureMode(r_textureMode->string);
GL_TexEnv(GL_MODULATE);
qglDisable(GL_TEXTURE_2D);
GL_SelectTexture(0);
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode(r_textureMode->string);
GL_TexEnv(GL_MODULATE);
qglShadeModel(GL_SMOOTH);
qglDepthFunc(GL_LEQUAL);
// the vertex array is always enabled, but the color and texture
// arrays are enabled and disabled around the compiled vertex array call
qglEnableClientState(GL_VERTEX_ARRAY);
// make sure our GL state vector is set correctly
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//*SEB* ? not the best place !
glLockArraysEXT = NULL;
glUnlockArraysEXT = NULL;
qglDepthMask(GL_TRUE);
qglDisable(GL_DEPTH_TEST);
qglEnable(GL_SCISSOR_TEST);
qglDisable(GL_CULL_FACE);
qglDisable(GL_BLEND);
}
示例7: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
//qglClearColor (1,0, 0.5 , 0.5); // NeVo - fucking ugly color!
qglClearColor (0,0,0,1); // NeVo - clear to black
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666);
qglDisable (GL_DEPTH_TEST);
qglDisable (GL_CULL_FACE);
qglDisable (GL_BLEND);
qglColor4f (1,1,1,1);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglShadeModel (GL_FLAT);
GL_TextureMode( gl_texturemode->string );
GL_TextureAlphaMode( gl_texturealphamode->string );
GL_TextureSolidMode( gl_texturesolidmode->string );
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv( GL_REPLACE );
if ( qglPointParameterfEXT )
{
float attenuations[3];
attenuations[0] = gl_particle_att_a->value;
attenuations[1] = gl_particle_att_b->value;
attenuations[2] = gl_particle_att_c->value;
qglEnable( GL_POINT_SMOOTH );
qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value );
qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value );
qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations );
}
if ( qglColorTableEXT && gl_ext_palettedtexture->value )
{
qglEnable( GL_SHARED_TEXTURE_PALETTE_EXT );
GL_SetTexturePalette( d_8to24table );
}
GL_UpdateSwapInterval();
}
示例8: RE_BeginFrame
/*
====================
RE_BeginFrame
If running in stereo, RE_BeginFrame will be called twice
for each RE_EndFrame
====================
*/
void RE_BeginFrame(stereoFrame_t stereoFrame)
{
drawBufferCommand_t *cmd;
if (!tr.registered)
{
return;
}
glState.finishCalled = qfalse;
tr.frameCount++;
tr.frameSceneNum = 0;
// texturemode stuff
if (r_textureMode->modified)
{
R_IssuePendingRenderCommands();
GL_TextureMode(r_textureMode->string);
r_textureMode->modified = qfalse;
}
// gamma stuff
if (r_gamma->modified)
{
r_gamma->modified = qfalse;
R_IssuePendingRenderCommands();
R_SetColorMappings();
}
// check for errors
if (!r_ignoreGLErrors->integer)
{
int err;
R_IssuePendingRenderCommands();
if ((err = qglGetError()) != GL_NO_ERROR)
{
ri.Error(ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!\n", err);
}
}
// draw buffer stuff
cmd = R_GetCommandBuffer(sizeof(*cmd));
if (!cmd)
{
return;
}
cmd->commandId = RC_DRAW_BUFFER;
cmd->buffer = (int)GL_BACK;
}
示例9: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
GL_BindNullTextures();
if (glRefConfig.framebufferObject)
GL_BindNullFramebuffers();
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
//qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.storedGlState = 0;
glState.faceCulling = CT_TWO_SIDED;
glState.faceCullFront = qtrue;
GL_BindNullProgram();
if (glRefConfig.vertexArrayObject)
qglBindVertexArray(0);
qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glState.currentVao = NULL;
glState.vertexAttribsEnabled = 0;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
if (glRefConfig.seamlessCubeMap)
qglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// GL_POLYGON_OFFSET_FILL will be glEnable()d when this is used
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); // FIXME: get color of sky
}
示例10: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearColor (1.0f, 0.0f, 0.5f, 0.5f);
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666f);
qglDisable (GL_DEPTH_TEST);
qglDisable (GL_CULL_FACE);
qglDisable (GL_BLEND);
qglColor4fv(colorWhite);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglShadeModel (GL_FLAT);
GL_TextureMode( gl_texturemode->string );
GL_TextureAlphaMode( gl_texturealphamode->string );
GL_TextureSolidMode( gl_texturesolidmode->string );
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv( GL_REPLACE );
if ( qglPointParameterfEXT && FLOAT_NE_ZERO(gl_ext_pointparameters->value))
{
float attenuations[3];
attenuations[0] = gl_particle_att_a->value;
attenuations[1] = gl_particle_att_b->value;
attenuations[2] = gl_particle_att_c->value;
qglEnable( GL_POINT_SMOOTH );
qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value );
qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value );
qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations );
}
gl_swapinterval->modified = true;
GL_UpdateSwapInterval();
}
示例11: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
glClearColor (1.0f, 0.0f, 0.5f, 0.5f);
glCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666f);
qglDisable (GL_DEPTH_TEST);
qglDisable (GL_CULL_FACE);
qglDisable (GL_BLEND);
qglColor4f(colorWhite[0], colorWhite[1], colorWhite[2], colorWhite[3]);
GL_TextureMode( gl_texturemode->string );
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv(GL_TEXTURE0, GL_REPLACE);
gl_swapinterval->modified = true;
GL_UpdateSwapInterval();
}
示例12: RE_BeginFrame
/*
====================
RE_BeginFrame
If running in stereo, RE_BeginFrame will be called twice
for each RE_EndFrame
====================
*/
void RE_BeginFrame( stereoFrame_t stereoFrame ) {
drawBufferCommand_t *cmd;
if ( !tr.registered ) {
return;
}
glState.finishCalled = qfalse;
tr.frameCount++;
tr.frameSceneNum = 0;
//
// do overdraw measurement
//
if ( r_measureOverdraw->integer )
{
if ( glConfig.stencilBits < 4 )
{
ri->Printf( PRINT_ALL, "Warning: not enough stencil bits to measure overdraw: %d\n", glConfig.stencilBits );
ri->Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else if ( r_shadows->integer == 2 )
{
ri->Printf( PRINT_ALL, "Warning: stencil shadows and overdraw measurement are mutually exclusive\n" );
ri->Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else
{
R_IssuePendingRenderCommands();
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 0U, ~0U );
qglStencilOp( GL_KEEP, GL_INCR, GL_INCR );
}
r_measureOverdraw->modified = qfalse;
}
else
{
// this is only reached if it was on and is now off
if ( r_measureOverdraw->modified ) {
R_IssuePendingRenderCommands();
qglDisable( GL_STENCIL_TEST );
}
r_measureOverdraw->modified = qfalse;
}
//
// texturemode stuff
//
if ( r_textureMode->modified || r_ext_texture_filter_anisotropic->modified) {
R_IssuePendingRenderCommands();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
r_ext_texture_filter_anisotropic->modified = qfalse;
}
//
// gamma stuff
//
if ( r_gamma->modified ) {
r_gamma->modified = qfalse;
R_IssuePendingRenderCommands();
R_SetColorMappings();
}
// check for errors
if ( !r_ignoreGLErrors->integer ) {
int err;
R_IssuePendingRenderCommands();
if ( ( err = qglGetError() ) != GL_NO_ERROR ) {
Com_Error( ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!\n", err );
}
}
//
// draw buffer stuff
//
cmd = (drawBufferCommand_t *) R_GetCommandBuffer( sizeof( *cmd ) );
if ( !cmd ) {
return;
}
cmd->commandId = RC_DRAW_BUFFER;
if ( glConfig.stereoEnabled ) {
if ( stereoFrame == STEREO_LEFT ) {
cmd->buffer = (int)GL_BACK_LEFT;
} else if ( stereoFrame == STEREO_RIGHT ) {
//.........這裏部分代碼省略.........
示例13: RE_BeginFrame
/*
====================
RE_BeginFrame
====================
*/
void RE_BeginFrame( void )
{
drawBufferCommand_t *cmd;
if ( !tr.registered )
{
return;
}
GLimp_LogComment( "--- RE_BeginFrame ---\n" );
tr.frameCount++;
tr.frameSceneNum = 0;
tr.viewCount = 0;
// do overdraw measurement
if ( r_measureOverdraw->integer )
{
if ( glConfig.stencilBits < 4 )
{
ri.Printf( PRINT_ALL, "Warning: not enough stencil bits to measure overdraw: %d\n", glConfig.stencilBits );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else
{
R_SyncRenderThread();
glEnable( GL_STENCIL_TEST );
glStencilMask( ~0U );
GL_ClearStencil( 0U );
glStencilFunc( GL_ALWAYS, 0U, ~0U );
glStencilOp( GL_KEEP, GL_INCR, GL_INCR );
}
r_measureOverdraw->modified = qfalse;
}
else
{
// this is only reached if it was on and is now off
if ( r_measureOverdraw->modified )
{
R_SyncRenderThread();
glDisable( GL_STENCIL_TEST );
}
r_measureOverdraw->modified = qfalse;
}
// texturemode stuff
if ( r_textureMode->modified )
{
R_SyncRenderThread();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
}
// check for errors
if ( !r_ignoreGLErrors->integer )
{
int err;
char s[ 128 ];
R_SyncRenderThread();
if ( ( err = glGetError() ) != GL_NO_ERROR )
{
switch ( err )
{
case GL_INVALID_ENUM:
strcpy( s, "GL_INVALID_ENUM" );
break;
case GL_INVALID_VALUE:
strcpy( s, "GL_INVALID_VALUE" );
break;
case GL_INVALID_OPERATION:
strcpy( s, "GL_INVALID_OPERATION" );
break;
case GL_STACK_OVERFLOW:
strcpy( s, "GL_STACK_OVERFLOW" );
break;
case GL_STACK_UNDERFLOW:
strcpy( s, "GL_STACK_UNDERFLOW" );
break;
case GL_OUT_OF_MEMORY:
strcpy( s, "GL_OUT_OF_MEMORY" );
break;
case GL_TABLE_TOO_LARGE:
strcpy( s, "GL_TABLE_TOO_LARGE" );
break;
//.........這裏部分代碼省略.........
示例14: RE_BeginFrame
/*
====================
RE_BeginFrame
If running in stereo, RE_BeginFrame will be called twice
for each RE_EndFrame
====================
*/
void RE_BeginFrame( stereoFrame_t stereoFrame ) {
drawBufferCommand_t *cmd;
if ( !tr.registered ) {
return;
}
glState.finishCalled = qfalse;
tr.frameCount++;
tr.frameSceneNum = 0;
//
// do overdraw measurement
//
if ( r_measureOverdraw->integer ) {
if ( glConfig.stencilBits < 4 ) {
ri.Printf( PRINT_ALL, "Warning: not enough stencil bits to measure overdraw: %d\n", glConfig.stencilBits );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
} else if ( r_shadows->integer == 2 ) {
ri.Printf( PRINT_ALL, "Warning: stencil shadows and overdraw measurement are mutually exclusive\n" );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
} else
{
R_SyncRenderThread();
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 0U, ~0U );
qglStencilOp( GL_KEEP, GL_INCR, GL_INCR );
}
r_measureOverdraw->modified = qfalse;
} else
{
// this is only reached if it was on and is now off
if ( r_measureOverdraw->modified ) {
R_SyncRenderThread();
qglDisable( GL_STENCIL_TEST );
}
r_measureOverdraw->modified = qfalse;
}
//
// texturemode stuff
//
if ( r_textureMode->modified ) {
R_SyncRenderThread();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
}
//
// NVidia stuff
//
// fog control
if ( glConfig.NVFogAvailable && r_nv_fogdist_mode->modified ) {
r_nv_fogdist_mode->modified = qfalse;
if ( !Q_stricmp( r_nv_fogdist_mode->string, "GL_EYE_PLANE_ABSOLUTE_NV" ) ) {
glConfig.NVFogMode = (int)GL_EYE_PLANE_ABSOLUTE_NV;
} else if ( !Q_stricmp( r_nv_fogdist_mode->string, "GL_EYE_PLANE" ) ) {
glConfig.NVFogMode = (int)GL_EYE_PLANE;
} else if ( !Q_stricmp( r_nv_fogdist_mode->string, "GL_EYE_RADIAL_NV" ) ) {
glConfig.NVFogMode = (int)GL_EYE_RADIAL_NV;
} else {
// in case this was really 'else', store a valid value for next time
glConfig.NVFogMode = (int)GL_EYE_RADIAL_NV;
ri.Cvar_Set( "r_nv_fogdist_mode", "GL_EYE_RADIAL_NV" );
}
}
//
// gamma stuff
//
if ( r_gamma->modified ) {
r_gamma->modified = qfalse;
R_SyncRenderThread();
R_SetColorMappings();
}
// check for errors
if ( !r_ignoreGLErrors->integer ) {
int err;
R_SyncRenderThread();
if ( ( err = qglGetError() ) != GL_NO_ERROR ) {
ri.Error( ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!\n", err );
}
}
//.........這裏部分代碼省略.........
示例15: RE_BeginFrame
/*
====================
RE_BeginFrame
If running in stereo, RE_BeginFrame will be called twice
for each RE_EndFrame
====================
*/
void RE_BeginFrame( stereoFrame_t stereoFrame ) {
drawBufferCommand_t *cmd;
if ( !tr.registered ) {
return;
}
glState.finishCalled = qfalse;
tr.frameCount++;
tr.frameSceneNum = 0;
backEnd.traceShader = tr.traceShader;
backEnd.doneBloom = qfalse;
backEnd.doneSurfaces = qfalse;
backEnd.sceneZfar = 2048;
tr.traceShader = qfalse;
//
// do overdraw measurement
//
if ( r_measureOverdraw->integer )
{
if ( glConfig.stencilBits < 4 )
{
ri.Printf( PRINT_ALL, "Warning: not enough stencil bits to measure overdraw: %d\n", glConfig.stencilBits );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else if ( r_shadows->integer == 2 )
{
ri.Printf( PRINT_ALL, "Warning: stencil shadows and overdraw measurement are mutually exclusive\n" );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else if ( mme_saveStencil->integer )
{
ri.Printf( PRINT_ALL, "Warning: mme stencil masks and overdraw measurement are mutually exclusive\n" );
ri.Cvar_Set( "r_measureOverdraw", "0" );
r_measureOverdraw->modified = qfalse;
}
else
{
R_SyncRenderThread();
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 0U, ~0U );
qglStencilOp( GL_KEEP, GL_INCR, GL_INCR );
}
r_measureOverdraw->modified = qfalse;
}
else
{
// this is only reached if it was on and is now off
if ( r_measureOverdraw->modified ) {
R_SyncRenderThread();
qglDisable( GL_STENCIL_TEST );
}
r_measureOverdraw->modified = qfalse;
}
if ( mme_saveStencil->integer == 1 ) {
R_SyncRenderThread();
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 255U, 255U );
qglStencilOp( GL_KEEP, GL_KEEP, GL_ZERO );
backEnd.doingStencil = qfalse;
} else if ( mme_saveStencil->integer == 2 ) {
R_SyncRenderThread();
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 255U, 255U );
qglStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
backEnd.doingStencil = qfalse;
} else {
qglDisable( GL_STENCIL_TEST );
}
//
// texturemode stuff
//
if ( r_textureMode->modified ) {
R_SyncRenderThread();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
}
if ( r_anisotropy->modified ) {
R_SyncRenderThread();
//.........這裏部分代碼省略.........