本文整理汇总了C++中GL_Cull函数的典型用法代码示例。如果您正苦于以下问题:C++ GL_Cull函数的具体用法?C++ GL_Cull怎么用?C++ GL_Cull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GL_Cull函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GLRB_DebugPolygon
/*
================
R_DebugPolygon
================
*/
void GLRB_DebugPolygon( int color, int numPoints, const float *points ) {
int i;
GL_Bind( tr.whiteImage);
GL_Cull( CT_FRONT_SIDED );
GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
// draw solid shade
qglColor3f( color&1, (color>>1)&1, (color>>2)&1 );
qglBegin( GL_POLYGON );
for ( i = 0 ; i < numPoints ; i++ ) {
qglVertex3fv( points + i * 3 );
}
qglEnd();
// draw wireframe outline
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
qglDepthRange( 0, 0 );
qglColor3f( 1, 1, 1 );
qglBegin( GL_POLYGON );
for ( i = 0 ; i < numPoints ; i++ ) {
qglVertex3fv( points + i * 3 );
}
qglEnd();
qglDepthRange( 0, 1 );
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:32,代码来源:gl_driver.c
示例2: RB_SetGL2D
/*
================
RB_SetGL2D
================
*/
void RB_SetGL2D (void) {
if ( tess.numIndexes | tess.numVertexes )
Com_Printf(" Going 2d with verts?" );
backEnd.projection2D = qtrue;
backEnd.currentModel = 0;
// set 2D virtual screen size
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
qglMatrixMode(GL_MODELVIEW);
qglLoadIdentity ();
GL_State( GLS_DEPTHTEST_DISABLE |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_CLIP_PLANE0 );
// set time for 2D shaders
// tess.shaderTime = ri.Milliseconds();
}
开发者ID:entdark,项目名称:q3mme,代码行数:31,代码来源:tr_backend.c
示例3: R_Set2DMode
/*
===============
R_Set2DMode
===============
*/
void R_Set2DMode( qboolean enable )
{
if( enable )
{
if( glState.in2DMode )
return;
// set 2D virtual screen size
pglScissor( 0, 0, glState.width, glState.height );
pglViewport( 0, 0, glState.width, glState.height );
pglMatrixMode( GL_PROJECTION );
pglLoadIdentity();
pglOrtho( 0, glState.width, glState.height, 0, -99999, 99999 );
pglMatrixMode( GL_MODELVIEW );
pglLoadIdentity();
GL_Cull( 0 );
pglDepthMask( GL_FALSE );
pglDisable( GL_DEPTH_TEST );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
glState.in2DMode = true;
RI.currententity = NULL;
RI.currentmodel = NULL;
}
else
{
pglDepthMask( GL_TRUE );
pglEnable( GL_DEPTH_TEST );
pglMatrixMode( GL_MODELVIEW );
glState.in2DMode = false;
}
}
开发者ID:bmk10,项目名称:sing-engine,代码行数:39,代码来源:gl_draw.c
示例4: 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;
}
qglEnable( GL_STENCIL_TEST );
qglStencilFunc( GL_NOTEQUAL, 0, 255 );
qglDisable (GL_CLIP_PLANE0);
GL_Cull( CT_TWO_SIDED );
GL_Bind( tr.whiteImage );
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 );
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 );
}
开发者ID:GrangerHub,项目名称:tremulous,代码行数:43,代码来源:tr_shadows.cpp
示例5: RB_SetGL2D
/*
================
RB_SetGL2D
================
*/
void RB_SetGL2D( void ) {
backEnd.projection2D = qtrue;
// set 2D virtual screen size
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglMatrixMode( GL_PROJECTION );
qglLoadIdentity();
qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
qglMatrixMode( GL_MODELVIEW );
qglLoadIdentity();
GL_State( GLS_DEPTHTEST_DISABLE |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
qglDisable( GL_FOG ); //----(SA) added
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_CLIP_PLANE0 );
// set time for 2D shaders
backEnd.refdef.time = ri.Milliseconds();
backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:31,代码来源:tr_backend.c
示例6: R_ShadowPassSetupGL
/*
=============
R_ShadowPassSetupGL
=============
*/
static void R_ShadowPassSetupGL( const plight_t *pl )
{
// matrices already computed
RI.worldviewMatrix = pl->modelviewMatrix;
RI.projectionMatrix = pl->projectionMatrix;
RI.worldviewProjectionMatrix = RI.projectionMatrix.Concat( RI.worldviewMatrix );
GLfloat dest[16];
// tell engine about worldviewprojection matrix so TriWorldToScreen and TriScreenToWorld
// will be working properly
RI.worldviewProjectionMatrix.CopyToArray( dest );
SET_ENGINE_WORLDVIEW_MATRIX( dest );
pglScissor( RI.scissor[0], RI.scissor[1], RI.scissor[2], RI.scissor[3] );
pglViewport( RI.viewport[0], RI.viewport[1], RI.viewport[2], RI.viewport[3] );
pglMatrixMode( GL_PROJECTION );
GL_LoadMatrix( RI.projectionMatrix );
pglMatrixMode( GL_MODELVIEW );
GL_LoadMatrix( RI.worldviewMatrix );
GL_Cull( GL_FRONT );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
pglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
pglEnable( GL_POLYGON_OFFSET_FILL );
pglDisable( GL_TEXTURE_2D );
pglDepthMask( GL_TRUE );
pglPolygonOffset( 8, 30 );
pglEnable( GL_DEPTH_TEST );
pglDisable( GL_ALPHA_TEST );
pglDisable( GL_BLEND );
}
开发者ID:FWGS,项目名称:XashXT,代码行数:40,代码来源:r_shadows.cpp
示例7: 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
示例8: 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 );
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();
}
开发者ID:Ichimoto,项目名称:OpenJK,代码行数:66,代码来源:tr_shadows.cpp
示例9: R_BloomScreen
/*
=================
R_BloomScreen
=================
*/
void R_BloomScreen( void )
{
if( !r_bloom->integer )
return;
if(r_bloom_sky_only->integer)
return;
if ( backEnd.doneBloom )
return;
if ( !backEnd.doneSurfaces )
return;
backEnd.doneBloom = qtrue;
if( !bloom.started ) {
R_Bloom_InitTextures();
if( !bloom.started )
return;
}
if ( !backEnd.projection2D )
RB_SetGL2D();
#if 0
// set up full screen workspace
GL_TexEnv( GL_MODULATE );
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglMatrixMode( GL_PROJECTION );
qglLoadIdentity ();
qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
qglMatrixMode( GL_MODELVIEW );
qglLoadIdentity ();
GL_Cull( CT_TWO_SIDED );
#endif
qglColor4f( 1, 1, 1, 1 );
//Backup the old screen in a texture
R_Bloom_BackupScreen();
// create the bloom texture using one of a few methods
if(r_bloom_cascade->integer)
R_Bloom_Cascaded();
else
R_Bloom_WarsowEffect ();
// R_Bloom_CreateEffect();
// restore the screen-backup to the screen
R_Bloom_RestoreScreen();
// Do the final pass using the bloom texture for the final effect
R_Bloom_DrawEffect ();
// LEILEI - Lens Bloom Hack
// The concept of this is to inverse the coordinates on both X and Y,
// then scale outward using the offset value applied, as well as the modulated color
// applied to give a rainbow streak effect. Most effective with high bloom darkness
// values.
if(r_bloom_reflection->integer)
R_Bloom_LensEffect ();
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:61,代码来源:tr_bloom.c
示例10: GLRB_ResetState2D
void GLRB_ResetState2D( void )
{
qglLoadIdentity();
GL_State( GLS_DEPTHTEST_DISABLE |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_CLIP_PLANE0 );
}
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:11,代码来源:gl_driver.c
示例11: 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 );
GL_Cull( CT_FRONT_SIDED );
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:ioquake,项目名称:ioq3,代码行数:57,代码来源:tr_sky.c
示例12: R_SetupGL
/*
=============
R_SetupGL
=============
*/
static void R_SetupGL( void )
{
if( RI.refdef.waterlevel >= 3 )
{
float f;
f = sin( cl.time * 0.4f * ( M_PI * 2.7f ));
RI.refdef.fov_x += f;
RI.refdef.fov_y -= f;
}
R_SetupModelviewMatrix( &RI.refdef, RI.worldviewMatrix );
R_SetupProjectionMatrix( &RI.refdef, RI.projectionMatrix );
// if( RI.params & RP_MIRRORVIEW ) RI.projectionMatrix[0][0] = -RI.projectionMatrix[0][0];
Matrix4x4_Concat( RI.worldviewProjectionMatrix, RI.projectionMatrix, RI.worldviewMatrix );
pglScissor( RI.scissor[0], RI.scissor[1], RI.scissor[2], RI.scissor[3] );
pglViewport( RI.viewport[0], RI.viewport[1], RI.viewport[2], RI.viewport[3] );
pglMatrixMode( GL_PROJECTION );
GL_LoadMatrix( RI.projectionMatrix );
pglMatrixMode( GL_MODELVIEW );
GL_LoadMatrix( RI.worldviewMatrix );
if( RI.params & RP_CLIPPLANE )
{
GLdouble clip[4];
mplane_t *p = &RI.clipPlane;
clip[0] = p->normal[0];
clip[1] = p->normal[1];
clip[2] = p->normal[2];
clip[3] = -p->dist;
pglClipPlane( GL_CLIP_PLANE0, clip );
pglEnable( GL_CLIP_PLANE0 );
}
if( RI.params & RP_FLIPFRONTFACE )
GL_FrontFace( !glState.frontFace );
GL_Cull( GL_FRONT );
pglDisable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
开发者ID:Rhoin,项目名称:Xash3D-CrossPlatform-Port,代码行数:53,代码来源:gl_rmain.c
示例13: if
/*
============================
idAutoRender::RenderFrame
============================
*/
void idAutoRender::RenderFrame()
{
// values are 0 to 1
float loadingIconPosX = 0.5f;
float loadingIconPosY = 0.6f;
float loadingIconScale = 0.025f;
float loadingIconSpeed = 0.095f;
if( autoRenderIcon == AUTORENDER_HELLICON )
{
loadingIconPosX = 0.85f;
loadingIconPosY = 0.85f;
loadingIconScale = 0.1f;
loadingIconSpeed = 0.095f;
}
else if( autoRenderIcon == AUTORENDER_DIALOGICON )
{
loadingIconPosY = 0.73f;
}
GL_SetDefaultState();
GL_Cull( CT_TWO_SIDED );
const bool stereoRender = false;
const int width = renderSystem->GetWidth();
const int height = renderSystem->GetHeight();
const int guardBand = height / 24;
if( stereoRender )
{
for( int viewNum = 0 ; viewNum < 2; viewNum++ )
{
GL_ViewportAndScissor( 0, viewNum * ( height + guardBand ), width, height );
RenderBackground();
RenderLoadingIcon( loadingIconPosX, loadingIconPosY, loadingIconScale, loadingIconSpeed );
}
}
else
{
GL_ViewportAndScissor( 0, 0, width, height );
RenderBackground();
RenderLoadingIcon( loadingIconPosX, loadingIconPosY, loadingIconScale, loadingIconSpeed );
}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:53,代码来源:AutoRender.cpp
示例14: RB_SetGL2D
/*
================
RB_SetGL2D
================
*/
void RB_SetGL2D (void) {
mat4_t matrix;
int width, height;
if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO)
return;
backEnd.projection2D = qtrue;
backEnd.last2DFBO = glState.currentFBO;
if (glState.currentFBO)
{
width = glState.currentFBO->width;
height = glState.currentFBO->height;
}
else
{
width = glConfig.vidWidth;
height = glConfig.vidHeight;
}
// set 2D virtual screen size
qglViewport( 0, 0, width, height );
qglScissor( 0, 0, width, height );
Mat4Ortho(0, width, height, 0, 0, 1, matrix);
GL_SetProjectionMatrix(matrix);
Mat4Identity(matrix);
GL_SetModelviewMatrix(matrix);
GL_State( GLS_DEPTHTEST_DISABLE |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_CLIP_PLANE0 );
// set time for 2D shaders
backEnd.refdef.time = ri.Milliseconds();
backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
// reset color scaling
backEnd.refdef.colorScale = 1.0f;
}
开发者ID:openmoh,项目名称:ioq3,代码行数:50,代码来源:tr_backend.c
示例15: RB_SetGL2D
/*
=============
RB_SetGL2D
This is not used by the normal game paths, just by some tools
=============
*/
void RB_SetGL2D( void ) {
// set 2D virtual screen size
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
if ( r_useScissor.GetBool() ) {
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
}
qglMatrixMode( GL_PROJECTION );
qglLoadIdentity();
qglOrtho( 0, 640, 480, 0, 0, 1 ); // always assume 640x480 virtual coordinates
qglMatrixMode( GL_MODELVIEW );
qglLoadIdentity();
GL_State( GLS_DEPTHFUNC_ALWAYS |
GLS_SRCBLEND_SRC_ALPHA |
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
GL_Cull( CT_TWO_SIDED );
qglDisable( GL_DEPTH_TEST );
qglDisable( GL_STENCIL_TEST );
}
开发者ID:albertz,项目名称:iodoom3,代码行数:28,代码来源:tr_backend.cpp
示例16: RB_BeginDrawingView
/*
=================
RB_BeginDrawingView
Any mirrored or portaled views have already been drawn, so prepare
to actually render the visible surfaces for this view
=================
*/
void RB_BeginDrawingView (void) {
// set the modelview matrix for the viewer
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf( backEnd.viewDef->projectionMatrix );
qglMatrixMode(GL_MODELVIEW);
// set the window clipping
qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1,
tr.viewportOffset[1] + backEnd.viewDef->viewport.y1,
backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1,
backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 );
// the scissor may be smaller than the viewport for subviews
qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1,
tr.viewportOffset[1] + backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1,
backEnd.viewDef->scissor.x2 + 1 - backEnd.viewDef->scissor.x1,
backEnd.viewDef->scissor.y2 + 1 - backEnd.viewDef->scissor.y1 );
backEnd.currentScissor = backEnd.viewDef->scissor;
// ensures that depth writes are enabled for the depth clear
GL_State( GLS_DEFAULT );
// we don't have to clear the depth / stencil buffer for 2D rendering
if ( backEnd.viewDef->viewEntitys ) {
qglStencilMask( 0xff );
// some cards may have 7 bit stencil buffers, so don't assume this
// should be 128
qglClearStencil( 1<<(glConfig.stencilBits-1) );
qglClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
qglEnable( GL_DEPTH_TEST );
} else {
qglDisable( GL_DEPTH_TEST );
qglDisable( GL_STENCIL_TEST );
}
backEnd.glState.faceCulling = -1; // force face culling to set next time
GL_Cull( CT_FRONT_SIDED );
}
开发者ID:0culus,项目名称:Doom3-for-MacOSX-,代码行数:47,代码来源:tr_render.cpp
示例17: R_PostprocessScreen
/*
=================
R_PostprocessScreen
=================
*/
void R_PostprocessScreen( void )
{
if( !postprocess )
return;
if ( backEnd.donepostproc )
return;
if ( !backEnd.doneSurfaces )
return;
backEnd.donepostproc = qtrue;
if( !postproc.started ) {
R_Postprocess_InitTextures();
if( !postproc.started )
return;
}
if ( !backEnd.projection2D )
RB_SetGL2D();
#if 0
// set up full screen workspace
GL_TexEnv( GL_MODULATE );
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglMatrixMode( GL_PROJECTION );
qglLoadIdentity ();
qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 );
qglMatrixMode( GL_MODELVIEW );
qglLoadIdentity ();
GL_Cull( CT_TWO_SIDED );
#endif
qglColor4f( 1, 1, 1, 1 );
//Backup the old screen in a texture
R_Postprocess_BackupScreen();
//Redraw texture using GLSL program
R_Bloom_RestoreScreen_Postprocessed();
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:43,代码来源:tr_bloom.c
示例18: 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
示例19: Tess_StageIteratorSky
/*
================
Tess_StageIteratorSky
All of the visible sky triangles are in tess
Other things could be stuck in here, like birds in the sky, etc
================
*/
void Tess_StageIteratorSky( void )
{
// log this call
if ( r_logFile->integer )
{
// don't just call LogComment, or we will get
// a call to va() every frame!
GLimp_LogComment( va
( "--- Tess_StageIteratorSky( %s, %i vertices, %i triangles ) ---\n", tess.surfaceShader->name,
tess.numVertexes, tess.numIndexes / 3 ) );
}
if ( r_fastsky->integer )
{
return;
}
// trebor: HACK why does this happen with cg_draw2D 0 ?
if ( tess.stageIteratorFunc2 == NULL )
{
//tess.stageIteratorFunc2 = Tess_StageIteratorGeneric;
ri.Error( ERR_FATAL, "tess.stageIteratorFunc == NULL" );
}
GL_Cull(CT_TWO_SIDED);
if ( tess.stageIteratorFunc2 == &Tess_StageIteratorDepthFill )
{
// go through all the polygons and project them onto
// the sky box to see which blocks on each side need
// to be drawn
Tess_ClipSkyPolygons();
// generate the vertexes for all the clouds, which will be drawn
// by the generic shader routine
BuildCloudData();
if ( tess.numVertexes || tess.multiDrawPrimitives )
{
tess.stageIteratorFunc2();
}
}
else
{
if ( tess.stageIteratorFunc2 == &Tess_StageIteratorGBuffer )
{
R_BindFBO( tr.geometricRenderFBO );
}
// go through all the polygons and project them onto
// the sky box to see which blocks on each side need
// to be drawn
Tess_ClipSkyPolygons();
// 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 )
{
glDepthRange( 0.0, 0.0 );
}
else
{
glDepthRange( 1.0, 1.0 );
}
// draw the outer skybox
if ( tess.surfaceShader->sky.outerbox && tess.surfaceShader->sky.outerbox != tr.blackCubeImage )
{
#if 1
R_BindVBO( tess.vbo );
R_BindIBO( tess.ibo );
gl_skyboxShader->BindProgram();
gl_skyboxShader->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin ); // in world space
gl_skyboxShader->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_skyboxShader->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[ glState.stackIndex ] );
gl_skyboxShader->SetRequiredVertexPointers();
// bind u_ColorMap
GL_SelectTexture( 0 );
GL_Bind( tess.surfaceShader->sky.outerbox );
DrawSkyBox( tess.surfaceShader );
#endif
}
//.........这里部分代码省略.........
开发者ID:Asvarox,项目名称:Unvanquished,代码行数:101,代码来源:tr_sky.cpp
示例20: RB_StageIteratorLightmappedMultitexture
void RB_StageIteratorLightmappedMultitexture( void ) {
shaderCommands_t *input;
input = &tess;
//
// log this call
//
if ( r_logFile->integer ) {
// don't just call LogComment, or we will get
// a call to va() every frame!
GLimp_LogComment( va( "--- RB_StageIteratorLightmappedMultitexture( %s ) ---\n", tess.shader->name ) );
}
// set GL fog
SetIteratorFog();
//
// set face culling appropriately
//
GL_Cull( input->shader->cullType );
//
// set color, pointers, and lock
//
GL_State( GLS_DEFAULT );
qglVertexPointer( 3, GL_FLOAT, 16, input->xyz );
#ifdef REPLACE_MODE
qglDisableClientState( GL_COLOR_ARRAY );
qglColor3f( 1, 1, 1 );
qglShadeModel( GL_FLAT );
#else
qglEnableClientState( GL_COLOR_ARRAY );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.constantColor255 );
#endif
//
// select base stage
//
GL_SelectTexture( 0 );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
R_BindAnimatedImage( &tess.xstages[0]->bundle[0] );
qglTexCoordPointer( 2, GL_FLOAT, 8, tess.texCoords0 );
//
// configure second stage
//
GL_SelectTexture( 1 );
qglEnable( GL_TEXTURE_2D );
if ( r_lightmap->integer ) {
GL_TexEnv( GL_REPLACE );
} else {
GL_TexEnv( GL_MODULATE );
}
//----(SA) modified for snooper
if ( tess.xstages[0]->bundle[1].isLightmap && ( backEnd.refdef.rdflags & RDF_SNOOPERVIEW ) ) {
GL_Bind( tr.whiteImage );
} else {
R_BindAnimatedImage( &tess.xstages[0]->bundle[1] );
}
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 8, tess.texCoords1 );
//
// lock arrays
//
if ( qglLockArraysEXT ) {
qglLockArraysEXT( 0, input->numVertexes );
GLimp_LogComment( "glLockArraysEXT\n" );
}
R_DrawElements( input->numIndexes, input->indexes );
//
// disable texturing on TEXTURE1, then select TEXTURE0
//
qglDisable( GL_TEXTURE_2D );
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
GL_SelectTexture( 0 );
#ifdef REPLACE_MODE
GL_TexEnv( GL_MODULATE );
qglShadeModel( GL_SMOOTH );
#endif
//
// now do any dynamic lighting needed
//
//% if ( tess.dlightBits && tess.shader->sort <= SS_OPAQUE )
if ( tess.dlightBits && tess.shader->fogPass &&
!( tess.shader->surfaceFlags & ( SURF_NODLIGHT | SURF_SKY ) ) ) {
if ( r_dynamiclight->integer == 2 ) {
DynamicLightPass();
} else {
DynamicLightSinglePass();
}
//.........这里部分代码省略.........
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:101,代码来源:tr_shade.c
注:本文中的GL_Cull函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论