本文整理汇总了C++中qglPopMatrix函数的典型用法代码示例。如果您正苦于以下问题:C++ qglPopMatrix函数的具体用法?C++ qglPopMatrix怎么用?C++ qglPopMatrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglPopMatrix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:49,代码来源:tr_worldeffects.cpp
示例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_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;
}
开发者ID:BSzili,项目名称:OpenJK,代码行数:68,代码来源:tr_sky.cpp
示例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 );
}
开发者ID:BielBdeLuna,项目名称:dhewm3,代码行数:65,代码来源:draw_common.cpp
示例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);
}
开发者ID:CairnTrenor,项目名称:OpenJK,代码行数:62,代码来源:tr_backend.cpp
示例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
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:55,代码来源:gl_warp.c
示例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 ();
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:58,代码来源:gl_sky.c
示例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 ();
}
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:50,代码来源:r_sky.c
示例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;
}
开发者ID:icanhas,项目名称:yantar,代码行数:57,代码来源:sky.c
示例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;
}
开发者ID:Razish,项目名称:QtZ,代码行数:50,代码来源:tr_sky.c
示例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
}
开发者ID:petmac,项目名称:quake2-lite,代码行数:45,代码来源:gu_warp.c
示例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);
}
开发者ID:L0rdWaffles,项目名称:OpenJK,代码行数:48,代码来源:tr_backend.cpp
示例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 );
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:42,代码来源:tr_sky.cpp
示例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();
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:37,代码来源:gl_driver.c
示例15: RB_DistortionFill
//.........这里部分代码省略.........
#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);
qglTexCoord2f(1-spost2, 0+spost);
qglVertex2f(glConfig.vidWidth, glConfig.vidHeight);
qglTexCoord2f(1-spost2, 1-spost);
qglVertex2f(glConfig.vidWidth, 0);
qglEnd();
#endif
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.0008 + tr.refdef.timeFraction * 0.0008);
if (spost < 0.0f)
{
spost = -spost;
}
spost *= 0.08f;
spost2 = sin(tr.refdef.time * 0.0008 + tr.refdef.timeFraction * 0.0008);
if (spost2 < 0.0f)
{
spost2 = -spost2;
}
spost2 *= 0.2f;
#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);
#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);
qglTexCoord2f(1-spost2, 0+spost);
qglVertex2f(glConfig.vidWidth, glConfig.vidHeight);
qglTexCoord2f(1-spost2, 1-spost);
qglVertex2f(glConfig.vidWidth, 0);
qglEnd();
#endif
}
#ifdef HAVE_GLES
if (glcol)
qglEnableClientState(GL_COLOR_ARRAY);
if (!text)
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
//pop the view matrices back
qglMatrixMode(GL_PROJECTION);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW);
qglPopMatrix();
qglDisable( GL_STENCIL_TEST );
}
开发者ID:entdark,项目名称:jaMME,代码行数:101,代码来源:tr_shadows.cpp
示例16: 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
示例17: RB_DrawSun
//.........这里部分代码省略.........
// farthest depth range
qglDepthRange(1.0, 1.0);
color[0] = color[1] = color[2] = color[3] = 255;
// simpler sun drawing
RB_BeginSurface(tr.sunShader, tess.fogNum);
RB_AddQuadStamp(origin, vec1, vec2, color);
/*
// vec3_t temp; init moved down
VectorCopy( origin, temp );
VectorSubtract( temp, vec1, temp );
VectorSubtract( temp, vec2, temp );
VectorCopy( temp, tess.xyz[tess.numVertexes].v );
tess.texCoords0[tess.numVertexes].v[0] = 0;
tess.texCoords0[tess.numVertexes].v[1] = 0;
tess.vertexColors[tess.numVertexes].v[0] = 255;
tess.vertexColors[tess.numVertexes].v[1] = 255;
tess.vertexColors[tess.numVertexes].v[2] = 255;
tess.numVertexes++;
VectorCopy( origin, temp );
VectorAdd( temp, vec1, temp );
VectorSubtract( temp, vec2, temp );
VectorCopy( temp, tess.xyz[tess.numVertexes].v );
tess.texCoords0[tess.numVertexes].v[0] = 0;
tess.texCoords0[tess.numVertexes].v[1] = 1;
tess.vertexColors[tess.numVertexes].v[0] = 255;
tess.vertexColors[tess.numVertexes].v[1] = 255;
tess.vertexColors[tess.numVertexes].v[2] = 255;
tess.numVertexes++;
VectorCopy( origin, temp );
VectorAdd( temp, vec1, temp );
VectorAdd( temp, vec2, temp );
VectorCopy( temp, tess.xyz[tess.numVertexes].v );
tess.texCoords0[tess.numVertexes].v[0] = 1;
tess.texCoords0[tess.numVertexes].v[1] = 1;
tess.vertexColors[tess.numVertexes].v[0] = 255;
tess.vertexColors[tess.numVertexes].v[1] = 255;
tess.vertexColors[tess.numVertexes].v[2] = 255;
tess.numVertexes++;
VectorCopy( origin, temp );
VectorSubtract( temp, vec1, temp );
VectorAdd( temp, vec2, temp );
VectorCopy( temp, tess.xyz[tess.numVertexes].v );
tess.texCoords0[tess.numVertexes].v[0] = 1;
tess.texCoords0[tess.numVertexes].v[1] = 0;
tess.vertexColors[tess.numVertexes].v[0] = 255;
tess.vertexColors[tess.numVertexes].v[1] = 255;
tess.vertexColors[tess.numVertexes].v[2] = 255;
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 1;
tess.indexes[tess.numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 3;
*/
RB_EndSurface();
if (r_drawSun->integer > 1) // draw flare effect
{
vec3_t temp;
// FYI: This is cheezy and was only a test so far.
// If we decide to use the flare business I will /definatly/ improve all this
// get a point a little closer
dist = dist * 0.7;
VectorScale(tr.sunDirection, dist, origin);
// and make the flare a little smaller
VectorScale(vec1, 0.5f, vec1);
VectorScale(vec2, 0.5f, vec2);
// add the vectors to give an 'off angle' result
VectorAdd(tr.sunDirection, backEnd.viewParms.orientation.axis[0], temp);
VectorNormalize(temp);
// amplify the result
origin[0] += temp[0] * 500.0;
origin[1] += temp[1] * 500.0;
origin[2] += temp[2] * 500.0;
// FIXME: todo: flare effect should render last (on top of everything else) and only when sun is in view (sun moving out of camera past degree n should start to cause flare dimming until view angle to sun is off by angle n + x.
// draw the flare
RB_BeginSurface(tr.sunflareShader[0], tess.fogNum);
RB_AddQuadStamp(origin, vec1, vec2, color);
RB_EndSurface();
}
// back to normal depth range
qglDepthRange(0.0, 1.0);
qglPopMatrix();
}
开发者ID:grepwood,项目名称:etlegacy,代码行数:101,代码来源:tr_sky.c
示例18: R_DrawAliasModel
//.........这里部分代码省略.........
else
{
if (currententity->skinnum >= MAX_MD2SKINS)
skin = currentmodel->skins[0];
else
{
skin = currentmodel->skins[currententity->skinnum];
if (!skin)
skin = currentmodel->skins[0];
}
}
if (!skin)
skin = r_notexture; // fallback...
GL_Bind(skin->texnum);
// draw it
qglShadeModel (GL_SMOOTH);
GL_TexEnv( GL_MODULATE );
if ( currententity->flags & RF_TRANSLUCENT )
{
qglEnable (GL_BLEND);
}
if ( (currententity->frame >= paliashdr->num_frames)
|| (currententity->frame < 0) )
{
ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n",
currentmodel->name, currententity->frame);
currententity->frame = 0;
currententity->oldframe = 0;
}
if ( (currententity->oldframe >= paliashdr->num_frames)
|| (currententity->oldframe < 0))
{
ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n",
currentmodel->name, currententity->oldframe);
currententity->frame = 0;
currententity->oldframe = 0;
}
if ( !r_lerpmodels->value )
currententity->backlerp = 0;
GL_DrawAliasFrameLerp (paliashdr, currententity->backlerp);
GL_TexEnv( GL_REPLACE );
qglShadeModel (GL_FLAT);
qglPopMatrix ();
#if 0
qglDisable( GL_CULL_FACE );
qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
qglDisable( GL_TEXTURE_2D );
qglBegin( GL_TRIANGLE_STRIP );
for ( i = 0; i < 8; i++ )
{
qglVertex3fv( bbox[i] );
}
qglEnd();
qglEnable( GL_TEXTURE_2D );
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
qglEnable( GL_CULL_FACE );
#endif
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
{
qglMatrixMode( GL_PROJECTION );
qglPopMatrix();
qglMatrixMode( GL_MODELVIEW );
qglCullFace( GL_FRONT );
}
if ( currententity->flags & RF_TRANSLUCENT )
{
qglDisable (GL_BLEND);
}
if (currententity->flags & RF_DEPTHHACK)
qglDepthRange (gldepthmin, gldepthmax);
#if 1
if (gl_shadows->value && !(currententity->flags & (RF_TRANSLUCENT | RF_WEAPONMODEL)))
{
qglPushMatrix ();
R_RotateForEntity (e);
qglDisable (GL_TEXTURE_2D);
qglEnable (GL_BLEND);
qglColor4f (0,0,0,0.5);
GL_DrawAliasShadow (paliashdr, currententity->frame );
qglEnable (GL_TEXTURE_2D);
qglDisable (GL_BLEND);
qglPopMatrix ();
}
#endif
qglColor4f (1,1,1,1);
}
开发者ID:AkBKukU,项目名称:Quake-2,代码行数:101,代码来源:gl_mesh.c
示例19: RB_BlurGlowTexture
//.........这里部分代码省略.........
/////////////////////////////////////////////////////////
// Draw the blur passes (each pass blurs it more, increasing the blur radius ).
/////////////////////////////////////////////////////////
//int iTexWidth = backEnd.viewParms.viewportWidth, iTexHeight = backEnd.viewParms.viewportHeight;
int iTexWidth = glConfig.vidWidth, iTexHeight = glConfig.vidHeight;
for ( int iNumBlurPasses = 0; iNumBlurPasses < r_DynamicGlowPasses->integer; iNumBlurPasses++ )
{
// Load the Texel Offsets into the Vertex Program.
qglProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 0, -fTexelWidthOffset, -fTexelWidthOffset, 0.0f, 0.0f );
qglProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 1, -fTexelWidthOffset, fTexelWidthOffset, 0.0f, 0.0f );
qglProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 2, fTexelWidthOffset, -fTexelWidthOffset, 0.0f, 0.0f );
qglProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 3, fTexelWidthOffset, fTexelWidthOffset, 0.0f, 0.0f );
// After first pass put the tex coords to the viewport size.
if ( iNumBlurPasses == 1 )
{
if ( !g_bTextureRectangleHack )
{
iTexWidth = backEnd.viewParms.viewportWidth;
iTexHeight = backEnd.viewParms.viewportHeight;
}
uiTex = tr.blurImage;
qglActiveTextureARB( GL_TEXTURE3_ARB );
qglDisable( GL_TEXTURE_2D );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglActiveTextureARB( GL_TEXTURE2_ARB );
qglDisable( GL_TEXTURE_2D );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglActiveTextureARB( GL_TEXTURE1_ARB );
qglDisable( GL_TEXTURE_2D );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglActiveTextureARB(GL_TEXTURE0_ARB );
qglDisable( GL_TEXTURE_2D );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
// Copy the current image over.
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
// Draw the fullscreen quad.
qglBegin( GL_QUADS );
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, iTexHeight );
qglVertex2f( 0, 0 );
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, 0, 0 );
qglVertex2f( 0, backEnd.viewParms.viewportHeight );
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, 0 );
qglVertex2f( backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
qglMultiTexCoord2fARB( GL_TEXTURE0_ARB, iTexWidth, iTexHeight );
qglVertex2f( backEnd.viewParms.viewportWidth, 0 );
qglEnd();
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.blurImage );
qglCopyTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, 0, 0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
// Increase the texel offsets.
// NOTE: This is possibly the most important input to the effect. Even by using an exponential function I've been able to
// make it look better (at a much higher cost of course). This is cheap though and still looks pretty great. In the future
// I might want to use an actual gaussian equation to correctly calculate the pixel coefficients and attenuates, texel
// offsets, gaussian amplitude and radius...
fTexelWidthOffset += r_DynamicGlowDelta->value;
fTexelHeightOffset += r_DynamicGlowDelta->value;
}
// Disable multi-texturing.
qglActiveTextureARB( GL_TEXTURE3_ARB );
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
qglActiveTextureARB( GL_TEXTURE2_ARB );
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
qglActiveTextureARB( GL_TEXTURE1_ARB );
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
qglActiveTextureARB(GL_TEXTURE0_ARB );
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
qglEnable( GL_TEXTURE_2D );
qglDisable( GL_VERTEX_PROGRAM_ARB );
EndPixelShader();
qglMatrixMode(GL_PROJECTION);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW);
qglPopMatrix();
qglDisable( GL_BLEND );
glState.currenttmu = 0; //this matches the last one we activated
}
开发者ID:BishopExile,项目名称:OpenJK,代码行数:101,代码来源:tr_backend.cpp
示例20: RB_DrawGlowOverlay
// Draw the glow blur over the screen additively.
static inline void RB_DrawGlowOverlay()
{
qglDisable (GL_CLIP_PLANE0);
GL_Cull( CT_TWO_SIDED );
// Go into orthographic 2d mode.
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity();
qglOrtho(0, glConfig.vidWidth, glConfig.vidHeight, 0, -1, 1);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity();
GL_State(GLS_DEPTHTEST_DISABLE);
qglDisable( GL_TEXTURE_2D );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
// For debug purposes.
if ( r_DynamicGlow->integer != 2 )
{
// Render the normal scene texture.
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.sceneImage );
qglBegin(GL_QUADS);
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
qglTexCoord2f( 0, glConfig.vidHeight );
qglVertex2f( 0, 0 );
qglTexCoord2f( 0, 0 );
qglVertex2f( 0, glConfig.vidHeight );
qglTexCoord2f( glConfig.vidWidth, 0 );
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
qglTexCoord2f( glConfig.vidWidth, glConfig.vidHeight );
qglVertex2f( glConfig.vidWidth, 0 );
qglEnd();
}
// One and Inverse Src Color give a very soft addition, while one one is a bit stronger. With one one we can
// use additive blending through multitexture though.
if ( r_DynamicGlowSoft->integer )
{
qglBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_COLOR );
}
else
{
qglBlendFunc( GL_ONE, GL_ONE );
}
qglEnable( GL_BLEND );
// Now additively render the glow texture.
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, tr.blurImage );
qglBegin(GL_QUADS);
qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
qglTexCoord2f( 0, r_DynamicGlowHeight->integer );
qglVertex2f( 0, 0 );
qglTexCoord2f( 0, 0 );
qglVertex2f( 0, glConfig.vidHeight );
qglTexCoord2f( r_DynamicGlowWidth->integer, 0 );
qglVertex2f( glConfig.vidWidth, glConfig.vidHeight );
qglTexCoord2f( r_DynamicGlowWidth->integer, r_DynamicGlowHeight->integer );
qglVertex2f( glConfig.vidWidth, 0 );
qglEnd();
qglDisable( GL_TEXTURE_RECTANGLE_EXT );
qglEnable( GL_TEXTURE_2D );
qglBlendFunc( GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR );
qglDisable( GL_BLEND );
qglMatrixMode(GL_PROJECTION);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW);
qglPopMatrix();
}
开发者ID:BishopExile,项目名称:OpenJK,代码行数:80,代码来源:tr_backend.cpp
注:本文中的qglPopMatrix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论