本文整理汇总了C++中qglStencilOp函数的典型用法代码示例。如果您正苦于以下问题:C++ qglStencilOp函数的具体用法?C++ qglStencilOp怎么用?C++ qglStencilOp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglStencilOp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GLRB_ShadowSilhouette
void GLRB_ShadowSilhouette( const float* edges, int edgeCount )
{
GL_Bind( tr.whiteImage );
qglEnable( GL_CULL_FACE );
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor3f( 0.2f, 0.2f, 0.2f );
// don't write to the color buffer
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_ALWAYS, 1, 255 );
// mirrors have the culling order reversed
GL_Cull( CT_BACK_SIDED ); // @pjb: resolves to GL_FRONT if to mirror flag is set
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
RenderShadowEdges( edges, edgeCount );
GL_Cull( CT_FRONT_SIDED ); // @pjb: resolves to GL_BACK due to mirror flag is set
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
RenderShadowEdges( edges, edgeCount );
// reenable writing to the color buffer
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:27,代码来源:gl_shadows.c
示例2: RB_ShadowFinish
/*
=================
RB_ShadowFinish
Darken everything that is is a shadow volume.
We have to delay this until everything has been shadowed,
because otherwise shadows from different body parts would
overlap and double darken.
=================
*/
void RB_ShadowFinish( void ) {
#if defined(VV_LIGHTING) && defined(_XBOX)
StencilShadower.FinishShadows();
#else
if ( r_shadows->integer != 2 ) {
return;
}
if ( glConfig.stencilBits < 4 ) {
return;
}
#ifdef _DEBUG_STENCIL_SHADOWS
return;
#endif
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_NOTEQUAL, 0, 255 );
qglStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
bool planeZeroBack = false;
if (qglIsEnabled(GL_CLIP_PLANE0))
{
planeZeroBack = true;
qglDisable (GL_CLIP_PLANE0);
}
GL_Cull(CT_TWO_SIDED);
//qglDisable (GL_CULL_FACE);
GL_Bind( tr.whiteImage );
qglPushMatrix();
qglLoadIdentity ();
// qglColor3f( 0.6f, 0.6f, 0.6f );
// GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO );
// qglColor3f( 1, 0, 0 );
// GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor4f( 0.0f, 0.0f, 0.0f, 0.5f );
//GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
qglBegin( GL_QUADS );
qglVertex3f( -100, 100, -10 );
qglVertex3f( 100, 100, -10 );
qglVertex3f( 100, -100, -10 );
qglVertex3f( -100, -100, -10 );
qglEnd ();
qglColor4f(1,1,1,1);
qglDisable( GL_STENCIL_TEST );
if (planeZeroBack)
{
qglEnable (GL_CLIP_PLANE0);
}
qglPopMatrix();
#endif // VV_LIGHTING && _XBOX
}
开发者ID:3ddy,项目名称:Jedi-Outcast,代码行数:70,代码来源:tr_shadows.cpp
示例3: RB_StencilSurf
// stencil_surf0: clear stencil; draw, incrementing stencil where stencil == 0
// stencil_surf1: draw, incrementing stencil where stencil == 1
// ...
// stencil_surfN: draw, incrementing stencil where stencil == N
// draw_surfN: disable stencil write, color where stencil == N+1
// ...
// draw_surf1: color where stencil == 2
// draw_surf0: color where stencil == 1, disable stencil test
void const* RB_StencilSurf(void const* data)
{
stencilSurfCommand_t const* const cmd = (stencilSurfCommand_t const* const)data;
// Finish any 2D drawing if needed
if(tess.numIndexes)
RB_EndSurface();
backEnd.refdef = cmd->refdef;
backEnd.viewParms = cmd->viewParms;
if(r_subviewStencil->integer)
{
// First stencil surface for this view
if(0 == backEnd.stencil_level)
{
assert(qfalse == backEnd.stencil_draw);
qglClear(GL_STENCIL_BUFFER_BIT);
qglEnable(GL_STENCIL_TEST);
backEnd.stencil_test = qtrue;
// sfail/dpfail: KEEP, dppass: INCR
qglStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
backEnd.stencil_draw = qtrue;
}
qglStencilFunc(GL_EQUAL, backEnd.stencil_level, ~0U);
backEnd.stencil_level++;
RB_RenderDrawSurfList(cmd->drawSurf, 1);
backEnd.pc.c_stencilSurfaces++;
}
return cmd + 1;
}
开发者ID:asvo,项目名称:quake3.gpl.old,代码行数:42,代码来源:tr_backend.c
示例4: RB_StencilShadowPass
/*
=====================
RB_StencilShadowPass
Stencil test should already be enabled, and the stencil buffer should have
been set to 128 on any surfaces that might receive shadows
=====================
*/
void RB_StencilShadowPass(const drawSurf_t *drawSurfs)
{
if (!r_shadows.GetBool()) {
return;
}
if (!drawSurfs) {
return;
}
RB_LogComment("---------- RB_StencilShadowPass ----------\n");
globalImages->BindNull();
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
// for visualizing the shadows
if (r_showShadows.GetInteger()) {
if (r_showShadows.GetInteger() == 2) {
// draw filled in
GL_State(GLS_DEPTHMASK | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_LESS);
} else {
// draw as lines, filling the depth buffer
GL_State(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_POLYMODE_LINE | GLS_DEPTHFUNC_ALWAYS);
}
} else {
// don't write to the color buffer, just the stencil buffer
GL_State(GLS_DEPTHMASK | GLS_COLORMASK | GLS_ALPHAMASK | GLS_DEPTHFUNC_LESS);
}
if (r_shadowPolygonFactor.GetFloat() || r_shadowPolygonOffset.GetFloat()) {
qglPolygonOffset(r_shadowPolygonFactor.GetFloat(), -r_shadowPolygonOffset.GetFloat());
qglEnable(GL_POLYGON_OFFSET_FILL);
}
qglStencilFunc(GL_ALWAYS, 1, 255);
if (glConfig.depthBoundsTestAvailable && r_useDepthBoundsTest.GetBool()) {
qglEnable(GL_DEPTH_BOUNDS_TEST_EXT);
}
RB_RenderDrawSurfChainWithFunction(drawSurfs, RB_T_Shadow);
GL_Cull(CT_FRONT_SIDED);
if (r_shadowPolygonFactor.GetFloat() || r_shadowPolygonOffset.GetFloat()) {
qglDisable(GL_POLYGON_OFFSET_FILL);
}
if (glConfig.depthBoundsTestAvailable && r_useDepthBoundsTest.GetBool()) {
qglDisable(GL_DEPTH_BOUNDS_TEST_EXT);
}
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglStencilFunc(GL_GEQUAL, 128, 255);
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:65,代码来源:draw_common.cpp
示例5: RB_STD_FogAllLights
/*
==================
RB_STD_FogAllLights
==================
*/
void RB_STD_FogAllLights( void ) {
viewLight_t *vLight;
if ( r_skipFogLights.GetBool() || r_showOverDraw.GetInteger() != 0
|| backEnd.viewDef->isXraySubview /* dont fog in xray mode*/
) {
return;
}
qglDisable( GL_STENCIL_TEST );
for ( vLight = backEnd.viewDef->viewLights ; vLight ; vLight = vLight->next ) {
backEnd.vLight = vLight;
if ( !vLight->lightShader->IsFogLight() && !vLight->lightShader->IsBlendLight() ) {
continue;
}
#if 0 // _D3XP disabled that
if ( r_ignore.GetInteger() ) {
// we use the stencil buffer to guarantee that no pixels will be
// double fogged, which happens in some areas that are thousands of
// units from the origin
backEnd.currentScissor = vLight->scissorRect;
if ( r_useScissor.GetBool() ) {
qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 );
}
qglClear( GL_STENCIL_BUFFER_BIT );
qglEnable( GL_STENCIL_TEST );
// only pass on the cleared stencil values
qglStencilFunc( GL_EQUAL, 128, 255 );
// when we pass the stencil test and depth test and are going to draw,
// increment the stencil buffer so we don't ever draw on that pixel again
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
}
#endif
if ( vLight->lightShader->IsFogLight() ) {
RB_FogPass( vLight->globalInteractions, vLight->localInteractions );
} else if ( vLight->lightShader->IsBlendLight() ) {
RB_BlendLight( vLight->globalInteractions, vLight->localInteractions );
}
qglDisable( GL_STENCIL_TEST );
}
qglEnable( GL_STENCIL_TEST );
}
开发者ID:BielBdeLuna,项目名称:dhewm3,代码行数:58,代码来源:draw_common.cpp
示例6: GL_StencilOp
/*
==================
GL_StencilOp
==================
*/
void GL_StencilOp (uint fail, uint zFail, uint zPass){
if (glState.stencilOpFail[0] == fail && glState.stencilOpFail[1] == fail && glState.stencilOpZFail[0] == zFail && glState.stencilOpZFail[1] == zFail && glState.stencilOpZPass[0] == zPass && glState.stencilOpZPass[1] == zPass)
return;
glState.stencilOpFail[0] = fail;
glState.stencilOpFail[1] = fail;
glState.stencilOpZFail[0] = zFail;
glState.stencilOpZFail[1] = zFail;
glState.stencilOpZPass[0] = zPass;
glState.stencilOpZPass[1] = zPass;
qglStencilOp(fail, zFail, zPass);
}
开发者ID:Mirrorman95,项目名称:quake-2-evolved,代码行数:19,代码来源:r_glState.c
示例7: GLRB_SetOverdrawMeasureEnabled
void GLRB_SetOverdrawMeasureEnabled( qboolean enabled )
{
if ( !enabled )
{
qglDisable( GL_STENCIL_TEST );
}
else
{
qglEnable( GL_STENCIL_TEST );
qglStencilMask( ~0U );
qglClearStencil( 0U );
qglStencilFunc( GL_ALWAYS, 0U, ~0U );
qglStencilOp( GL_KEEP, GL_INCR, GL_INCR );
}
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:15,代码来源:gl_driver.c
示例8: RB_MaskTessEnd
void RB_MaskTessEnd( void ) {
shaderCommands_t *input;
input = &tess;
//qglClear( GL_COLOR_BUFFER_BIT );
qglColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
qglDepthMask(GL_FALSE);
qglEnable(GL_STENCIL_TEST);
qglClearStencil(0);
qglClear(GL_STENCIL_BUFFER_BIT);
qglStencilFunc(GL_ALWAYS,1,1);
qglStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
tess.currentStageIteratorFunc();
qglDepthMask(GL_TRUE);
qglColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
qglStencilFunc(GL_EQUAL,1,1);
qglStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
}
开发者ID:redrumrobot,项目名称:quakeconstruct,代码行数:24,代码来源:tr_shade.c
示例9: RB_EndSurface
/*
=============
RB_DrawSurfs
=============
*/
const void *RB_DrawSurfs( const void *data ) {
const drawSurfsCommand_t *cmd;
// finish any 2D drawing if needed
if ( tess.numIndexes ) {
RB_EndSurface();
}
cmd = (const drawSurfsCommand_t *)data;
backEnd.refdef = cmd->refdef;
backEnd.viewParms = cmd->viewParms;
if(r_subviewStencil->integer)
{
assert(backEnd.stencil_level == cmd->viewParms.subview_level);
if(qtrue == backEnd.stencil_draw)
{
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
backEnd.stencil_draw = qfalse;
}
if(backEnd.stencil_level)
{
// pass if: backEnd.stencil_level <= stencil
qglStencilFunc(GL_LEQUAL, backEnd.stencil_level, ~0U);
backEnd.stencil_level--;
}
}
RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs );
if(r_subviewStencil->integer)
{
if(backEnd.stencil_test && 0 == backEnd.stencil_level)
{
qglDisable(GL_STENCIL_TEST);
backEnd.stencil_test = qfalse;
}
}
return (const void *)(cmd + 1);
}
开发者ID:asvo,项目名称:quake3.gpl.old,代码行数:49,代码来源:tr_backend.c
示例10: RB_SetGLDefaults
/*
* RB_SetGLDefaults
*/
static void RB_SetGLDefaults( void )
{
if( glConfig.stencilBits )
{
qglStencilMask( ( GLuint ) ~0 );
qglStencilFunc( GL_EQUAL, 128, 0xFF );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
}
qglDisable( GL_CULL_FACE );
qglFrontFace( GL_CCW );
qglDisable( GL_BLEND );
qglDepthFunc( GL_LEQUAL );
qglDepthMask( GL_FALSE );
qglDisable( GL_POLYGON_OFFSET_FILL );
qglPolygonOffset( -1.0f, 0.0f ); // units will be handled by RB_DepthOffset
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglEnable( GL_DEPTH_TEST );
#ifndef GL_ES_VERSION_2_0
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
#endif
qglFrontFace( GL_CCW );
}
开发者ID:cfr,项目名称:qfusion,代码行数:26,代码来源:r_backend.c
示例11: RB_DoShadowTessEnd
//.........这里部分代码省略.........
d = planeEq[0]*lightPos[0]+
planeEq[1]*lightPos[1]+
planeEq[2]*lightPos[2]+
planeEq[3];
}
if ( d > 0 ) {
facing[ i ] = 1;
} else {
facing[ i ] = 0;
}
// create the edges
R_AddEdgeDef( i1, i2, facing[ i ] );
R_AddEdgeDef( i2, i3, facing[ i ] );
R_AddEdgeDef( i3, i1, facing[ i ] );
}
GL_Bind( tr.whiteImage );
//qglEnable( GL_CULL_FACE );
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
#ifndef _DEBUG_STENCIL_SHADOWS
qglColor3f( 0.2f, 0.2f, 0.2f );
// don't write to the color buffer
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_ALWAYS, 1, 255 );
#else
qglColor3f( 1.0f, 0.0f, 0.0f );
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//qglDisable(GL_DEPTH_TEST);
#endif
#ifdef _STENCIL_REVERSE
qglDepthFunc(GL_LESS);
//now using the Carmack Reverse<tm> -rww
if ( backEnd.viewParms.isMirror ) {
//qglCullFace( GL_BACK );
GL_Cull(CT_BACK_SIDED);
qglStencilOp( GL_KEEP, GL_INCR, GL_KEEP );
R_RenderShadowEdges();
//qglCullFace( GL_FRONT );
GL_Cull(CT_FRONT_SIDED);
qglStencilOp( GL_KEEP, GL_DECR, GL_KEEP );
R_RenderShadowEdges();
} else {
//qglCullFace( GL_FRONT );
GL_Cull(CT_FRONT_SIDED);
qglStencilOp( GL_KEEP, GL_INCR, GL_KEEP );
R_RenderShadowEdges();
//qglCullFace( GL_BACK );
GL_Cull(CT_BACK_SIDED);
qglStencilOp( GL_KEEP, GL_DECR, GL_KEEP );
R_RenderShadowEdges();
}
qglDepthFunc(GL_LEQUAL);
#else
// mirrors have the culling order reversed
if ( backEnd.viewParms.isMirror ) {
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
R_RenderShadowEdges();
} else {
qglCullFace( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
R_RenderShadowEdges();
}
#endif
// reenable writing to the color buffer
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
#ifdef _DEBUG_STENCIL_SHADOWS
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#endif
#endif // _XBOX
}
开发者ID:3ddy,项目名称:Jedi-Outcast,代码行数:101,代码来源:tr_shadows.cpp
示例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 ) {
//.........这里部分代码省略.........
开发者ID:Wookiee-,项目名称:jaPRO,代码行数:101,代码来源:tr_cmds.cpp
示例13: edge
/*
=================
RB_ShadowTessEnd
triangleFromEdge[ v1 ][ v2 ]
set triangle from edge( v1, v2, tri )
if ( facing[ triangleFromEdge[ v1 ][ v2 ] ] && !facing[ triangleFromEdge[ v2 ][ v1 ] ) {
}
=================
*/
void RB_ShadowTessEnd( void ) {
int i;
int numTris;
vec3_t lightDir;
// we can only do this if we have enough space in the vertex buffers
if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
return;
}
if ( glConfig.stencilBits < 4 ) {
return;
}
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
// project vertexes away from light direction
for ( i = 0 ; i < tess.numVertexes ; i++ ) {
VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i + tess.numVertexes] );
}
// decide which triangles face the light
memset( numEdgeDefs, 0, 4 * tess.numVertexes );
numTris = tess.numIndexes / 3;
for ( i = 0 ; i < numTris ; i++ ) {
int i1, i2, i3;
vec3_t d1, d2, normal;
float *v1, *v2, *v3;
float d;
i1 = tess.indexes[ i * 3 + 0 ];
i2 = tess.indexes[ i * 3 + 1 ];
i3 = tess.indexes[ i * 3 + 2 ];
v1 = tess.xyz[ i1 ];
v2 = tess.xyz[ i2 ];
v3 = tess.xyz[ i3 ];
VectorSubtract( v2, v1, d1 );
VectorSubtract( v3, v1, d2 );
CrossProduct( d1, d2, normal );
d = DotProduct( normal, lightDir );
if ( d > 0 ) {
facing[ i ] = 1;
} else {
facing[ i ] = 0;
}
// create the edges
R_AddEdgeDef( i1, i2, facing[ i ] );
R_AddEdgeDef( i2, i3, facing[ i ] );
R_AddEdgeDef( i3, i1, facing[ i ] );
}
// draw the silhouette edges
GL_Bind( tr.whiteImage );
qglEnable( GL_CULL_FACE );
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor3f( 0.2f, 0.2f, 0.2f );
// don't write to the color buffer
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_ALWAYS, 1, 255 );
// mirrors have the culling order reversed
if ( backEnd.viewParms.isMirror ) {
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
R_RenderShadowEdges();
} else {
qglCullFace( GL_BACK );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
//.........这里部分代码省略.........
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:101,代码来源:tr_shadows.c
示例14: RB_ShadowFinish
/*
=================
RB_ShadowFinish
Darken everything that is is a shadow volume.
We have to delay this until everything has been shadowed,
because otherwise shadows from different body parts would
overlap and double darken.
=================
*/
void RB_ShadowFinish( void ) {
if ( r_shadows->integer != 2 ) {
return;
}
if ( glConfig.stencilBits < 4 ) {
return;
}
#ifdef _DEBUG_STENCIL_SHADOWS
return;
#endif
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_NOTEQUAL, 0, 255 );
qglStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
bool planeZeroBack = false;
if (qglIsEnabled(GL_CLIP_PLANE0))
{
planeZeroBack = true;
qglDisable (GL_CLIP_PLANE0);
}
GL_Cull(CT_TWO_SIDED);
//qglDisable (GL_CULL_FACE);
GL_Bind( tr.whiteImage );
qglPushMatrix();
qglLoadIdentity ();
// qglColor3f( 0.6f, 0.6f, 0.6f );
// GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO );
// qglColor3f( 1, 0, 0 );
// GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor4f( 0.0f, 0.0f, 0.0f, 0.5f );
//GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
#ifdef HAVE_GLES
GLfloat vtx[] = {
-100, 100, -10,
100, 100, -10,
100, -100, -10,
-100, -100, -10
};
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (text)
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
if (glcol)
qglDisableClientState( GL_COLOR_ARRAY );
qglVertexPointer ( 3, GL_FLOAT, 0, vtx );
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
if (text)
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
if (glcol)
qglEnableClientState( GL_COLOR_ARRAY );
#else
qglBegin( GL_QUADS );
qglVertex3f( -100, 100, -10 );
qglVertex3f( 100, 100, -10 );
qglVertex3f( 100, -100, -10 );
qglVertex3f( -100, -100, -10 );
qglEnd ();
#endif
qglColor4f(1,1,1,1);
qglDisable( GL_STENCIL_TEST );
if (planeZeroBack)
{
qglEnable (GL_CLIP_PLANE0);
}
qglPopMatrix();
}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:87,代码来源:tr_shadows.cpp
示例15: edge
/*
=================
RB_ShadowTessEnd
triangleFromEdge[ v1 ][ v2 ]
set triangle from edge( v1, v2, tri )
if ( facing[ triangleFromEdge[ v1 ][ v2 ] ] && !facing[ triangleFromEdge[ v2 ][ v1 ] ) {
}
=================
*/
void RB_ShadowTessEnd( void ) {
int i;
int numTris;
vec3_t lightDir;
GLboolean rgba[4];
// we can only do this if we have enough space in the vertex buffers
if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
return;
}
if ( glConfig.stencilBits < 4 ) {
return;
}
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
// project vertexes away from light direction
for ( i = 0 ; i < tess.numVertexes ; i++ ) {
VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i+tess.numVertexes] );
}
// decide which triangles face the light
Com_Memset( numEdgeDefs, 0, 4 * tess.numVertexes );
numTris = tess.numIndexes / 3;
for ( i = 0 ; i < numTris ; i++ ) {
int i1, i2, i3;
vec3_t d1, d2, normal;
float *v1, *v2, *v3;
float d;
i1 = tess.indexes[ i*3 + 0 ];
i2 = tess.indexes[ i*3 + 1 ];
i3 = tess.indexes[ i*3 + 2 ];
v1 = tess.xyz[ i1 ];
v2 = tess.xyz[ i2 ];
v3 = tess.xyz[ i3 ];
VectorSubtract( v2, v1, d1 );
VectorSubtract( v3, v1, d2 );
CrossProduct( d1, d2, normal );
d = DotProduct( normal, lightDir );
if ( d > 0 ) {
facing[ i ] = 1;
} else {
facing[ i ] = 0;
}
// create the edges
R_AddEdgeDef( i1, i2, facing[ i ] );
R_AddEdgeDef( i2, i3, facing[ i ] );
R_AddEdgeDef( i3, i1, facing[ i ] );
}
// draw the silhouette edges
GL_Bind( tr.whiteImage );
qglEnable( GL_CULL_FACE );
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
qglColor3f( 0.2f, 0.2f, 0.2f );
// don't write to the color buffer
qglGetBooleanv(GL_COLOR_WRITEMASK, rgba);
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_ALWAYS, 1, 255 );
#ifdef HAVE_GLES
qglVertexPointer (3, GL_FLOAT, 16, tess.xyz);
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (text)
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
if (glcol)
qglDisableClientState( GL_COLOR_ARRAY );
#endif
// mirrors have the culling order reversed
if ( backEnd.viewParms.isMirror ) {
qglCullFace( GL_FRONT );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
R_RenderShadowEdges();
qglCullFace( GL_BACK );
//.........这里部分代码省略.........
开发者ID:ptitSeb,项目名称:SmokinGuns,代码行数:101,代码来源:tr_shadows.c
示例16: RB_DistortionFill
void RB_DistortionFill(void)
{
float alpha = tr_distortionAlpha;
float spost = 0.0f;
float spost2 = 0.0f;
if ( glConfig.stencilBits < 4 )
{
return;
}
//ok, cap the stupid thing now I guess
if (!tr_distortionPrePost)
{
RB_CaptureScreenImage();
}
qglEnable(GL_STENCIL_TEST);
qglStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
qglDisable (GL_CLIP_PLANE0);
GL_Cull( CT_TWO_SIDED );
//reset the view matrices and go into ortho mode
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity();
qglOrtho(0, glConfig.vidWidth, glConfig.vidHeight, 32, -1, 1);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity();
if (tr_distortionStretch)
{ //override
spost = tr_distortionStretch;
spost2 = tr_distortionStretch;
}
else
{ //do slow stretchy effect
spost = sin(tr.refdef.time*0.0005f);
if (spost < 0.0f)
{
spost = -spost;
}
spost *= 0.2f;
spost2 = sin(tr.refdef.time*0.0005f);
if (spost2 < 0.0f)
{
spost2 = -spost2;
}
spost2 *= 0.08f;
}
if (alpha != 1.0f)
{ //blend
GL_State(GLS_SRCBLEND_SRC_ALPHA|GLS_DSTBLEND_SRC_ALPHA);
}
else
{ //be sure to reset the draw state
GL_State(0);
}
#ifdef _XBOX
qglBeginEXT(GL_QUADS, 4, 0, 0, 4, 0);
#else
qglBegin(GL_QUADS);
#endif // _XBOX
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
qglTexCoord2f(0+spost2, 1-spost);
qglVertex2f(0, 0);
qglTexCoord2f(0+spost2, 0+spost);
qglVertex2f(0, glConfig.vidHeight);
qglTexCoord2f(1-spost2, 0+spost);
qglVertex2f(glConfig.vidWidth, glConfig.vidHeight);
qglTexCoord2f(1-spost2, 1-spost);
qglVertex2f(glConfig.vidWidth, 0);
qglEnd();
if (tr_distortionAlpha == 1.0f && tr_distortionStretch == 0.0f)
{ //no overrides
if (tr_distortionNegate)
{ //probably the crazy alternate saber trail
alpha = 0.8f;
GL_State(GLS_SRCBLEND_ZERO|GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
}
else
{
alpha = 0.5f;
GL_State(GLS_SRCBLEND_SRC_ALPHA|GLS_DSTBLEND_SRC_ALPHA);
}
spost = sin(tr.refdef.time*0.0008f);
if (spost < 0.0f)
{
spost = -spost;
//.........这里部分代码省略.........
开发者ID:3ddy,项目名称:Jedi-Outcast,代码行数:101,代码来源:tr_shadows.cpp
示例17: RB_T_Shadow
/*
=====================
RB_T_Shadow
the shadow volumes face INSIDE
=====================
*/
static void RB_T_Shadow( const drawSurf_t *surf ) {
const srfTriangles_t *tri;
// set the light position if we are using a vertex program to project the rear surfaces
if ( tr.backEndRendererHasVertexPrograms && r_useShadowVertexProgram.GetBool()
&& surf->space != backEnd.currentSpace ) {
idVec4 localLight;
R_GlobalPointToLocal( surf->space->modelMatrix, backEnd.vLight->globalLightOrigin, localLight.ToVec3() );
localLight.w = 0.0f;
qglProgramEnvParameter4fvARB( GL_VERTEX_PROGRAM_ARB, PP_LIGHT_ORIGIN, localLight.ToFloatPtr() );
}
tri = surf->geo;
if ( !tri->shadowCache ) {
return;
}
qglVertexPointer( 4, GL_FLOAT, sizeof( shadowCache_t ), vertexCache.Position(tri->shadowCache) );
// we always draw the sil planes, but we may not need to draw the front or rear caps
int numIndexes;
bool external = false;
if ( !r_useExternalShadows.GetInteger() ) {
numIndexes = tri->numIndexes;
} else if ( r_useExternalShadows.GetInteger() == 2 ) { // force to no caps for testing
numIndexes = tri->numShadowIndexesNoCaps;
} else if ( !(surf->dsFlags & DSF_VIEW_INSIDE_SHADOW) ) {
// if we aren't inside the shadow projection, no caps are ever needed needed
numIndexes = tri->numShadowIndexesNoCaps;
external = true;
} else if ( !backEnd.vLight->viewInsideLight && !(surf->geo->shadowCapPlaneBits & SHADOW_CAP_INFINITE) ) {
// if we are inside the shadow projection, but outside the light, and drawing
// a non-infinite shadow, we can skip some caps
if ( backEnd.vLight->viewSeesShadowPlaneBits & surf->geo->shadowCapPlaneBits ) {
// we can see through a rear cap, so we need to draw it, but we can skip the
// caps on the actual surface
numIndexes = tri->numShadowIndexesNoFrontCaps;
} else {
// we don't need to draw any caps
numIndexes = tri->numShadowIndexesNoCaps;
}
external = true;
} else {
// must draw everything
numIndexes = tri->numIndexes;
}
// set depth bounds
if( glConfig.depthBoundsTestAvailable && r_useDepthBoundsTest.GetBool() ) {
qglDepthBoundsEXT( surf->scissorRect.zmin, surf->scissorRect.zmax );
}
// debug visualization
if ( r_showShadows.GetInteger() ) {
if ( r_showShadows.GetInteger() == 3 ) {
if ( external ) {
qglColor3f( 0.1/backEnd.overBright, 1/backEnd.overBright, 0.1/backEnd.overBright );
} else {
// these are the surfaces that require the reverse
qglColor3f( 1/backEnd.overBright, 0.1/backEnd.overBright, 0.1/backEnd.overBright );
}
} else {
// draw different color for turboshadows
if ( surf->geo->shadowCapPlaneBits & SHADOW_CAP_INFINITE ) {
if ( numIndexes == tri->numIndexes ) {
qglColor3f( 1/backEnd.overBright, 0.1/backEnd.overBright, 0.1/backEnd.overBright );
} else {
qglColor3f( 1/backEnd.overBright, 0.4/backEnd.overBright, 0.1/backEnd.overBright );
}
} else {
if ( numIndexes == tri->numIndexes ) {
qglColor3f( 0.1/backEnd.overBright, 1/backEnd.overBright, 0.1/backEnd.overBright );
} else if ( numIndexes == tri->numShadowIndexesNoFrontCaps ) {
qglColor3f( 0.1/backEnd.overBright, 1/backEnd.overBright, 0.6/backEnd.overBright );
} else {
qglColor3f( 0.6/backEnd.overBright, 1/backEnd.overBright, 0.1/backEnd.overBright );
}
}
}
qglStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
qglDisable( GL_STENCIL_TEST );
GL_Cull( CT_TWO_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
GL_Cull( CT_FRONT_SIDED );
qglEnable( GL_STENCIL_TEST );
return;
}
//.........这里部分代码省略.........
开发者ID:BielBdeLuna,项目名称:dhewm3,代码行数:101,代码来源:draw_common.cpp
示例18: 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 = NULL;
colorMaskCommand_t *colcmd = NULL;
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_IssuePendingRenderCommands();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
}
//
// NVidia stuff
//
#ifndef VCMODS_OPENGLES
// 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" );
}
}
#endif
//
// 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)!", err );
//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,代码来源:tr_cmds.c
示例19: 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 = NULL;
colorMaskCommand_t *colcmd = NULL;
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_IssuePendingRenderCommands();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = qfalse;
}
//
// ATI stuff
//
// TRUFORM
if ( qglPNTrianglesiATI ) {
// tess
if ( r_ati_truform_tess->modified ) {
r_ati_truform_tess->modified = qfalse;
// cap if necessary
if ( r_ati_truform_tess->value > glConfig.ATIMaxTruformTess ) {
ri.Cvar_Set( "r_ati_truform_tess", va( "%d",glConfig.ATIMaxTruformTess ) );
}
qglPNTrianglesiATI( GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, r_ati_truform_tess->value );
}
// point mode
if ( r_ati_truform_pointmode->modified ) {
r_ati_truform_pointmode->modified = qfalse;
// GR - shorten the mode name
if ( !Q_stricmp( r_ati_truform_pointmode->string, "LINEAR" ) ) {
glConfig.ATIPointMode = (int)GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI;
// GR - fix point mode change
} else if ( !Q_stricmp( r_ati_truform_pointmode->string, "CUBIC" ) ) {
glConfig.ATIPointMode = (int)GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI;
} else {
// bogus value, set to valid
glConfig.ATIPointMode = (int)GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI;
ri.Cvar_Set( "r_ati_truform_pointmode", "LINEAR" );
}
qglPNTrianglesiATI( GL_PN_TRIANGLES_POINT_MODE_ATI, glConfig.ATIPointMode );
}
// normal mode
if ( r_ati_truform_normalmode->modified ) {
r_ati_truform_normalmode->modified = qfalse;
// GR - shorten the mode name
//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,代码来源:tr_cmds.c
示例20: RB_DistortionFill
void RB_DistortionFill(void)
{
float alpha = tr_distortionAlpha;
float spost = 0.0f;
float spost2 = 0.0f;
if ( glConfig.stencilBits < 4 )
{
return;
}
//ok, cap the stupid thing now I guess
if (!tr_distortionPrePost)
{
RB_CaptureScreenImage();
}
qglEnable(GL_STENCIL_TEST);
qglStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
qglDisable (GL_CLIP_PLANE0);
GL_Cull( CT_TWO_SIDED );
//reset the view matrices and go into ortho mode
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity();
qglOrtho(0, glConfig.vidWidth, glConfig.vidHeight, 32, -1, 1);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity();
if (tr_distortionStretch)
{ //override
spost = tr_distortionStretch;
spost2 = tr_distortionStretch;
}
else
{ //do slow stretchy effect
spost = sin(tr.refdef.time * 0.0005 + tr.refdef.timeFraction * 0.0005);
if (spost < 0.0f)
{
spost = -spost;
}
spost *= 0.2f;
spost2 = sin(tr.refdef.time * 0.0005 + tr.refdef.timeFraction * 0.0005);
if (spost2 < 0.0f)
{
spost2 = -spost2;
}
spost2 *= 0.08f;
}
if (alpha != 1.0f)
{ //blend
GL_State(GLS_SRCBLEND_SRC_ALPHA|GLS_DSTBLEND_SRC_ALPHA);
}
else
{ //be sure to reset the draw state
GL_State(0);
}
#ifdef HAVE_GLES
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
if (!text)
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (glcol)
qglDisableClientState(GL_COLOR_ARRAY);
GLfloat tex[] = {
0 + spost2, 1 - spost,
0 + spost2, 0 + spost,
1 - spost2, 0 + spost,
1 - spost2, 1 - spost
};
GLfloat vtx[] = {
0, 0,
0, glConfig.vidHeight,
glConfig.vidWidth, glConfig.vidHeight,
glConfig.vidWidth, 0
};
qglTexCoordPointer(2, GL_FLOAT, 0, tex);
qglVertexPointer(2, GL_FLOAT, 0, vtx);
qglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
/* if (glcol)
qglEnableClientState( GL_COLOR_ARRAY );
if (!text)
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );*/
#else
qglBegin(GL_QUADS);
qglColor4f(1.0f, 1.0f, 1.0f, alpha);
qglTexCoord2f(0+spost2, 1-spost);
qglVertex2f(0, 0);
qglTexCoord2f(0+spost2, 0+spost);
qglVertex2f(0, glConfig.vidHeight);
//.........这里部分代码省略.........
|
请发表评论