本文整理汇总了C++中qglPushMatrix函数的典型用法代码示例。如果您正苦于以下问题:C++ qglPushMatrix函数的具体用法?C++ qglPushMatrix怎么用?C++ qglPushMatrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglPushMatrix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qglMatrixMode
void CMistyFog2::Render(CWorldEffectsSystem *system)
{
if (mFadeAlpha <= 0.0)
{
return;
}
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity ();
MYgluPerspective (80.0, 1.0, 4, 2048.0);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity ();
qglRotatef (-90, 1, 0, 0); // put Z going up
qglRotatef (90, 0, 0, 1); // put Z going up
qglRotatef (0, 1, 0, 0);
qglRotatef (-90, 0, 1, 0);
qglRotatef (-90, 0, 0, 1);
qglDisable(GL_TEXTURE_2D);
GL_State(GLS_SRCBLEND_SRC_ALPHA|GLS_DSTBLEND_ONE);
qglShadeModel (GL_SMOOTH);
qglColorPointer(4, GL_FLOAT, 0, mColors);
qglEnableClientState(GL_COLOR_ARRAY);
qglVertexPointer( 3, GL_FLOAT, 0, mVerts );
qglEnableClientState(GL_VERTEX_ARRAY);
if (qglLockArraysEXT)
{
qglLockArraysEXT(0, MISTYFOG_HEIGHT*MISTYFOG_WIDTH);
}
qglDrawElements(GL_QUADS, (MISTYFOG_HEIGHT-1)*(MISTYFOG_WIDTH-1)*4, GL_UNSIGNED_INT, mIndexes);
if ( qglUnlockArraysEXT )
{
qglUnlockArraysEXT();
}
qglDisableClientState(GL_COLOR_ARRAY);
// qglDisableClientState(GL_VERTEX_ARRAY); backend doesn't ever re=enable this properly
qglPopMatrix();
qglMatrixMode(GL_PROJECTION);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW); // bug somewhere in the backend which requires this
}
示例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
}
示例3: RB_StageIteratorSky
/*
================
RB_StageIteratorSky
All of the visible sky triangles are in tess
Other things could be stuck in here, like birds in the sky, etc
================
*/
void RB_StageIteratorSky( void )
{
if ( g_bRenderGlowingObjects )
return;
if ( r_fastsky->integer ) {
return;
}
if (skyboxportal && !(backEnd.refdef.rdflags & RDF_SKYBOXPORTAL))
{
return;
}
// go through all the polygons and project them onto
// the sky box to see which blocks on each side need
// to be drawn
RB_ClipSkyPolygons( &tess );
// r_showsky will let all the sky blocks be drawn in
// front of everything to allow developers to see how
// much sky is getting sucked in
if ( r_showsky->integer ) {
qglDepthRange( 0.0, 0.0 );
} else {
qglDepthRange( 1.0, 1.0 );
}
// draw the outer skybox
if ( tess.shader->sky->outerbox[0] && tess.shader->sky->outerbox[0] != tr.defaultImage ) {
qglColor3f( tr.identityLight, tr.identityLight, tr.identityLight );
qglPushMatrix ();
GL_State( 0 );
qglTranslatef (backEnd.viewParms.ori.origin[0], backEnd.viewParms.ori.origin[1], backEnd.viewParms.ori.origin[2]);
DrawSkyBox( tess.shader );
qglPopMatrix();
}
// generate the vertexes for all the clouds, which will be drawn
// by the generic shader routine
R_BuildCloudData( &tess );
if (tess.numIndexes && tess.numVertexes)
{
RB_StageIteratorGeneric();
}
// draw the inner skybox
// back to normal depth range
qglDepthRange( 0.0, 1.0 );
// note that sky was drawn so we will draw a sun later
backEnd.skyRenderedThisView = qtrue;
}
示例4: RB_STD_LightScale
/*
==================
RB_STD_LightScale
Perform extra blending passes to multiply the entire buffer by
a floating point value
==================
*/
void RB_STD_LightScale( void ) {
float v, f;
if ( backEnd.overBright == 1.0f ) {
return;
}
if ( r_skipLightScale.GetBool() ) {
return;
}
// the scissor may be smaller than the viewport for subviews
if ( r_useScissor.GetBool() ) {
qglScissor( backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1,
backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1,
backEnd.viewDef->scissor.x2 - backEnd.viewDef->scissor.x1 + 1,
backEnd.viewDef->scissor.y2 - backEnd.viewDef->scissor.y1 + 1 );
backEnd.currentScissor = backEnd.viewDef->scissor;
}
// full screen blends
qglLoadIdentity();
qglMatrixMode( GL_PROJECTION );
qglPushMatrix();
qglLoadIdentity();
qglOrtho( 0, 1, 0, 1, -1, 1 );
GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR );
GL_Cull( CT_TWO_SIDED ); // so mirror views also get it
globalImages->BindNull();
qglDisable( GL_DEPTH_TEST );
qglDisable( GL_STENCIL_TEST );
v = 1;
while ( idMath::Fabs( v - backEnd.overBright ) > 0.01 ) { // a little extra slop
f = backEnd.overBright / v;
f /= 2;
if ( f > 1 ) {
f = 1;
}
qglColor3f( f, f, f );
v = v * f * 2;
qglBegin( GL_QUADS );
qglVertex2f( 0,0 );
qglVertex2f( 0,1 );
qglVertex2f( 1,1 );
qglVertex2f( 1,0 );
qglEnd();
}
qglPopMatrix();
qglEnable( GL_DEPTH_TEST );
qglMatrixMode( GL_MODELVIEW );
GL_Cull( CT_FRONT_SIDED );
}
示例5: RB_SetGL2D
/*
=============
RB_DrawRotatePic2
=============
*/
const void *RB_RotatePic2 ( const void *data )
{
const rotatePicCommand_t *cmd;
image_t *image;
shader_t *shader;
cmd = (const rotatePicCommand_t *)data;
shader = cmd->shader;
if ( shader->stages[0] )
{
image = shader->stages[0]->bundle[0].image[0];
if ( image )
{
if ( !backEnd.projection2D )
{
RB_SetGL2D();
}
// Get our current blend mode, etc.
GL_State( shader->stages[0]->stateBits );
qglColor4ubv( backEnd.color2D );
qglPushMatrix();
// rotation point is going to be around the center of the passed in coordinates
qglTranslatef( cmd->x, cmd->y, 0 );
qglRotatef( cmd->a, 0.0, 0.0, 1.0 );
GL_Bind( image );
qglBegin( GL_QUADS );
qglTexCoord2f( cmd->s1, cmd->t1);
qglVertex2f( -cmd->w * 0.5f, -cmd->h * 0.5f );
qglTexCoord2f( cmd->s2, cmd->t1 );
qglVertex2f( cmd->w * 0.5f, -cmd->h * 0.5f );
qglTexCoord2f( cmd->s2, cmd->t2 );
qglVertex2f( cmd->w * 0.5f, cmd->h * 0.5f );
qglTexCoord2f( cmd->s1, cmd->t2 );
qglVertex2f( -cmd->w * 0.5f, cmd->h * 0.5f );
qglEnd();
qglPopMatrix();
// Hmmm, this is not too cool
GL_State( GLS_DEPTHTEST_DISABLE |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
}
}
return (const void *)(cmd + 1);
}
示例6: R_DrawSkyBox
void R_DrawSkyBox (void)
{
int i;
#if 0
qglEnable (GL_BLEND);
GL_TexEnv( GL_MODULATE );
qglColor4f (1,1,1,0.5);
qglDisable (GL_DEPTH_TEST);
#endif
if (skyrotate)
{ // check for no sky at all
for (i=0 ; i<6 ; i++)
if (skymins[0][i] < skymaxs[0][i]
&& skymins[1][i] < skymaxs[1][i])
break;
if (i == 6)
return; // nothing visible
}
qglPushMatrix ();
qglTranslatef (r_origin[0], r_origin[1], r_origin[2]);
qglRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
for (i=0 ; i<6 ; i++)
{
if (skyrotate)
{ // hack, forces full sky to draw when rotating
skymins[0][i] = -1;
skymins[1][i] = -1;
skymaxs[0][i] = 1;
skymaxs[1][i] = 1;
}
if (skymins[0][i] >= skymaxs[0][i]
|| skymins[1][i] >= skymaxs[1][i])
continue;
GL_Bind (sky_images[skytexorder[i]]->texnum);
qglBegin (GL_QUADS);
MakeSkyVec (skymins[0][i], skymins[1][i], i);
MakeSkyVec (skymins[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymins[1][i], i);
qglEnd ();
}
qglPopMatrix ();
#if 0
glDisable (GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor4f (1,1,1,0.5);
glEnable (GL_DEPTH_TEST);
#endif
}
示例7: R_DrawSkyBox
/*
==============
R_DrawSkyBox
==============
*/
void R_DrawSkyBox( void ) {
static const int skytexorder[6] = {0,2,1,3,4,5};
vec5_t verts[4];
int i;
if( skyrotate ) {
// hack, forces full sky to draw when rotating
for( i = 0; i < 6; i++ ) {
skymins[0][i] = -1;
skymins[1][i] = -1;
skymaxs[0][i] = 1;
skymaxs[1][i] = 1;
}
} else {
// check for no sky at all
for( i = 0; i < 6; i++ ) {
if( SKY_VISIBLE( i ) ) {
break;
}
}
if( i == 6 ) {
return; // nothing visible
}
}
qglPushMatrix ();
qglTranslatef (glr.fd.vieworg[0], glr.fd.vieworg[1], glr.fd.vieworg[2]);
if( skyrotate ) {
qglRotatef (glr.fd.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
}
GL_TexEnv( GL_REPLACE );
GL_Bits( GLS_DEFAULT );
qglVertexPointer( 3, GL_FLOAT, 5*4, &verts[0][0] );
qglTexCoordPointer( 2, GL_FLOAT, 5*4, &verts[0][3] );
for( i = 0; i < 6; i++ ) {
if( !SKY_VISIBLE( i ) ) {
continue;
}
GL_BindTexture (sky_images[skytexorder[i]]);
MakeSkyVec (skymaxs[0][i], skymins[1][i], i, verts[0]);
MakeSkyVec (skymins[0][i], skymins[1][i], i, verts[1]);
MakeSkyVec (skymaxs[0][i], skymaxs[1][i], i, verts[2]);
MakeSkyVec (skymins[0][i], skymaxs[1][i], i, verts[3]);
qglDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
}
qglPopMatrix ();
}
示例8: R_DrawSkyBox
void R_DrawSkyBox (void)
{
int i;
if (skyrotate)
{ // check for no sky at all
for (i=0 ; i<6 ; i++)
if (skymins[0][i] < skymaxs[0][i]
&& skymins[1][i] < skymaxs[1][i])
break;
if (i == 6)
return; // nothing visible
}
qglPushMatrix ();
qglTranslatef (r_origin[0], r_origin[1], r_origin[2]);
qglRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
for (i=0; i<6; i++)
{
if (skyrotate)
{ // hack, forces full sky to draw when rotating
skymins[0][i] = -1;
skymins[1][i] = -1;
skymaxs[0][i] = 1;
skymaxs[1][i] = 1;
}
if (skymins[0][i] >= skymaxs[0][i]
|| skymins[1][i] >= skymaxs[1][i])
continue;
GL_Bind (sky_images[skytexorder[i]]->texnum);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
MakeSkyVec (skymins[0][i], skymins[1][i], i);
MakeSkyVec (skymins[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymins[1][i], i);
RB_RenderMeshGeneric (true);
}
qglPopMatrix ();
}
示例9: RB_StageIteratorSky
/*
* RB_StageIteratorSky
*
* All of the visible sky triangles are in tess
*
* Other things could be stuck in here, like birds in the sky, etc
*/
void
RB_StageIteratorSky(void)
{
if(r_fastsky->integer){
return;
}
/* go through all the polygons and project them onto
* the sky box to see which blocks on each side need
* to be drawn */
RB_ClipSkyPolygons(&tess);
/* r_showsky will let all the sky blocks be drawn in
* front of everything to allow developers to see how
* much sky is getting sucked in */
if(r_showsky->integer){
qglDepthRange(0.0, 0.0);
}else{
qglDepthRange(1.0, 1.0);
}
/* draw the outer skybox */
if(tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage){
qglColor3f(tr.identityLight, tr.identityLight, tr.identityLight);
qglPushMatrix ();
GL_State(0);
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1],
backEnd.viewParms.or.origin[2]);
DrawSkyBox(tess.shader);
qglPopMatrix();
}
/* generate the vertexes for all the clouds, which will be drawn
* by the generic shader routine */
R_BuildCloudData(&tess);
RB_StageIteratorGeneric();
/* draw the inner skybox */
/* back to normal depth range */
qglDepthRange(0.0, 1.0);
/* note that sky was drawn so we will draw a sun later */
backEnd.skyRenderedThisView = qtrue;
}
示例10: RB_StageIteratorSky
// All of the visible sky triangles are in tess
// Other things could be stuck in here, like birds in the sky, etc
void RB_StageIteratorSky( void ) {
if ( r_fastsky->integer ) {
return;
}
// go through all the polygons and project them onto
// the sky box to see which blocks on each side need
// to be drawn
RB_ClipSkyPolygons( &tess );
// r_showsky will let all the sky blocks be drawn in
// front of everything to allow developers to see how
// much sky is getting sucked in
if ( r_showsky->integer ) {
qglDepthRange( 0.0, 0.0 );
} else {
qglDepthRange( 1.0, 1.0 );
}
// draw the outer skybox
if ( tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage ) {
qglColor3f( tr.identityLight, tr.identityLight, tr.identityLight );
qglPushMatrix();
GL_State( 0 );
qglTranslatef ( backEnd.viewParms.or.origin.x, backEnd.viewParms.or.origin.y, backEnd.viewParms.or.origin.z );
DrawSkyBox( tess.shader );
qglPopMatrix();
}
// generate the vertexes for all the clouds, which will be drawn
// by the generic shader routine
R_BuildCloudData( &tess );
//QTZFIXME: This causes a load of GL errors when postprocessing is active :S
// RB_StageIteratorGeneric();
// draw the inner skybox
// back to normal depth range
qglDepthRange( 0.0, 1.0 );
// note that sky was drawn so we will draw a sun later
backEnd.skyRenderedThisView = qtrue;
}
示例11: R_DrawSkyBox
void R_DrawSkyBox (void)
{
#ifndef PSP
int i;
if (skyrotate)
{ // check for no sky at all
for (i=0 ; i<6 ; i++)
if (skymins[0][i] < skymaxs[0][i]
&& skymins[1][i] < skymaxs[1][i])
break;
if (i == 6)
return; // nothing visible
}
qglPushMatrix ();
qglTranslatef (r_origin[0], r_origin[1], r_origin[2]);
qglRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
for (i=0 ; i<6 ; i++)
{
if (skyrotate)
{ // hack, forces full sky to draw when rotating
skymins[0][i] = -1;
skymins[1][i] = -1;
skymaxs[0][i] = 1;
skymaxs[1][i] = 1;
}
if (skymins[0][i] >= skymaxs[0][i]
|| skymins[1][i] >= skymaxs[1][i])
continue;
GL_Bind (sky_images[skytexorder[i]]->texnum);
qglBegin (GL_QUADS);
MakeSkyVec (skymins[0][i], skymins[1][i], i);
MakeSkyVec (skymins[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymaxs[1][i], i);
MakeSkyVec (skymaxs[0][i], skymins[1][i], i);
qglEnd ();
}
qglPopMatrix ();
#endif
}
示例12: RB_SetGL2D
/*
=============
RB_DrawRotatePic
=============
*/
const void *RB_RotatePic ( const void *data )
{
const rotatePicCommand_t *cmd;
image_t *image;
shader_t *shader;
cmd = (const rotatePicCommand_t *)data;
shader = cmd->shader;
image = &shader->stages[0].bundle[0].image[0];
if ( image ) {
if ( !backEnd.projection2D ) {
RB_SetGL2D();
}
qglColor4ubv( backEnd.color2D );
qglPushMatrix();
qglTranslatef(cmd->x+cmd->w,cmd->y,0);
qglRotatef(cmd->a, 0.0, 0.0, 1.0);
GL_Bind( image );
#ifdef _XBOX
qglBeginEXT (GL_QUADS, 4, 0, 0, 4, 0);
#else
qglBegin (GL_QUADS);
#endif
qglTexCoord2f( cmd->s1, cmd->t1);
qglVertex2f( -cmd->w, 0 );
qglTexCoord2f( cmd->s2, cmd->t1 );
qglVertex2f( 0, 0 );
qglTexCoord2f( cmd->s2, cmd->t2 );
qglVertex2f( 0, cmd->h );
qglTexCoord2f( cmd->s1, cmd->t2 );
qglVertex2f( -cmd->w, cmd->h );
qglEnd();
qglPopMatrix();
}
return (const void *)(cmd + 1);
}
示例13: RB_StageIteratorSky
void RB_StageIteratorSky()
{
if ( r_fastsky->integer ) {
return;
}
GL_Program();
// project all the polygons onto the sky box
// to see which blocks on each side need to be drawn
RB_ClipSkyPolygons( &tess );
CalcSkyBounds();
// r_showsky will let all the sky blocks be drawn in
// front of everything to allow developers to see how
// much sky is getting sucked in
if ( r_showsky->integer ) {
qglDepthRange( 0.0, 0.0 );
} else {
qglDepthRange( 1.0, 1.0 );
}
// draw the outer skybox
if ( tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage ) {
qglColor3f( tr.identityLight, tr.identityLight, tr.identityLight );
qglPushMatrix();
GL_State( 0 );
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
DrawSkyBox( tess.shader );
qglPopMatrix();
}
// generate the vertexes for all the clouds (if any)
// which will be drawn by the generic shader routine
R_BuildCloudData( &tess );
if (tess.numVertexes)
ARB_StageIterator();
// back to normal depth range
qglDepthRange( 0.0, 1.0 );
}
示例14: GLRB_DrawSkyBox
void GLRB_DrawSkyBox( const skyboxDrawInfo_t* skybox, const float* eye_origin, const float* colorTint )
{
int i, j, k;
qglColor3fv( colorTint );
qglPushMatrix ();
GL_State( 0 );
qglTranslatef( eye_origin[0], eye_origin[1], eye_origin[2] );
for ( i = 0; i < 6; ++i )
{
const skyboxSideDrawInfo_t* side = &skybox->sides[i];
if ( !side->image )
continue;
GL_Bind( side->image );
for ( j = 0; j < side->stripCount; ++j )
{
int start = side->stripInfo[j].offset;
int end = side->stripInfo[j].length + start;
qglBegin( GL_TRIANGLE_STRIP );
for ( k = start; k < end; ++k )
{
qglTexCoord2fv( skybox->tbuffer + 2 * k );
qglVertex3fv( skybox->vbuffer + 3 * k );
}
qglEnd();
}
}
qglPopMatrix();
}
示例15: 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);
//.........这里部分代码省略.........