本文整理汇总了C++中qglPushMatrix函数的典型用法代码示例。如果您正苦于以下问题:C++ qglPushMatrix函数的具体用法?C++ qglPushMatrix怎么用?C++ qglPushMatrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglPushMatrix函数的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
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);
//.........这里部分代码省略.........
开发者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
/*
==============
RB_DrawSun
FIXME: sun should render behind clouds, so passing dark areas cover it up
==============
*/
void RB_DrawSun(void)
{
float size;
float dist;
vec3_t origin, vec1, vec2;
byte color[4];
if (!tr.sunShader)
{
return;
}
if (!backEnd.skyRenderedThisView)
{
return;
}
if (!r_drawSun->integer)
{
return;
}
qglPushMatrix();
qglLoadMatrixf(backEnd.viewParms.world.modelMatrix);
qglTranslatef(backEnd.viewParms.orientation.origin[0], backEnd.viewParms.orientation.origin[1], backEnd.viewParms.orientation.origin[2]);
dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
// shrunk the size of the sun
size = dist * 0.2;
VectorScale(tr.sunDirection, dist, origin);
PerpendicularVector(vec1, tr.sunDirection);
CrossProduct(tr.sunDirection, vec1, vec2);
VectorScale(vec1, size, vec1);
VectorScale(vec2, size, vec2);
// 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;
//.........这里部分代码省略.........
开发者ID:grepwood,项目名称:etlegacy,代码行数:101,代码来源:tr_sky.c
示例18: R_DrawAliasModel
//.........这里部分代码省略.........
{
shadelight[0] = 1.0;
shadelight[1] = 0.0;
shadelight[2] = 0.0;
}
// PGM
// =================
shadedots = r_avertexnormal_dots[((int)(currententity->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
an = currententity->angles[1]/180*M_PI;
shadevector[0] = cos(-an);
shadevector[1] = sin(-an);
shadevector[2] = 1;
VectorNormalize (shadevector);
//
// locate the proper data
//
c_alias_polys += paliashdr->num_tris;
//
// draw all the triangles
//
if (currententity->flags & RF_DEPTHHACK) // hack the depth range to prevent view model from poking into walls
qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
{
extern void MYgluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar );
qglMatrixMode( GL_PROJECTION );
qglPushMatrix();
qglLoadIdentity();
qglScalef( -1, 1, 1 );
MYgluPerspective( r_newrefdef.fov_y, ( float ) r_newrefdef.width / r_newrefdef.height, 4, 4096);
qglMatrixMode( GL_MODELVIEW );
qglCullFace( GL_BACK );
}
qglPushMatrix ();
e->angles[PITCH] = -e->angles[PITCH]; // sigh.
R_RotateForEntity (e);
e->angles[PITCH] = -e->angles[PITCH]; // sigh.
// select skin
if (currententity->skin)
skin = currententity->skin; // custom player skin
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
开发者ID:AkBKukU,项目名称:Quake-2,代码行数:67,代码来源:gl_mesh.c
示例19: RB_BlurGlowTexture
static inline void RB_BlurGlowTexture()
{
qglDisable (GL_CLIP_PLANE0);
GL_Cull( CT_TWO_SIDED );
// Go into orthographic 2d mode.
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity();
qglOrtho(0, backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight, 0, -1, 1);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity();
GL_State(GLS_DEPTHTEST_DISABLE);
/////////////////////////////////////////////////////////
// Setup vertex and pixel programs.
/////////////////////////////////////////////////////////
// NOTE: The 0.25 is because we're blending 4 textures (so = 1.0) and we want a relatively normalized pixel
// intensity distribution, but this won't happen anyways if intensity is higher than 1.0.
float fBlurDistribution = r_DynamicGlowIntensity->value * 0.25f;
float fBlurWeight[4] = { fBlurDistribution, fBlurDistribution, fBlurDistribution, 1.0f };
// Enable and set the Vertex Program.
qglEnable( GL_VERTEX_PROGRAM_ARB );
qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, tr.glowVShader );
// Apply Pixel Shaders.
if ( qglCombinerParameterfvNV )
{
BeginPixelShader( GL_REGISTER_COMBINERS_NV, tr.glowPShader );
// Pass the blur weight to the regcom.
qglCombinerParameterfvNV( GL_CONSTANT_COLOR0_NV, (float*)&fBlurWeight );
}
else if ( qglProgramEnvParameter4fARB )
{
BeginPixelShader( GL_FRAGMENT_PROGRAM_ARB, tr.glowPShader );
// Pass the blur weight to the Fragment Program.
qglProgramEnvParameter4fARB( GL_FRAGMENT_PROGRAM_ARB, 0, fBlurWeight[0], fBlurWeight[1], fBlurWeight[2], fBlurWeight[3] );
}
/////////////////////////////////////////////////////////
// Set the blur texture to the 4 texture stages.
/////////////////////////////////////////////////////////
// How much to offset each texel by.
float fTexelWidthOffset = 0.1f, fTexelHeightOffset = 0.1f;
GLuint uiTex = tr.screenGlow;
qglActiveTextureARB( GL_TEXTURE3_ARB );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglActiveTextureARB( GL_TEXTURE2_ARB );
qglEnable( GL_TEXTURE_RECTANGLE_EXT );
qglBindTexture( GL_TEXTURE_RECTANGLE_EXT, uiTex );
qglActiveTextureARB( GL_TEXTURE1_ARB );
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 );
/////////////////////////////////////////////////////////
// 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 );
//.........这里部分代码省略.........
开发者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
注:本文中的qglPushMatrix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论