本文整理匯總了C++中GL_Cull函數的典型用法代碼示例。如果您正苦於以下問題:C++ GL_Cull函數的具體用法?C++ GL_Cull怎麽用?C++ GL_Cull使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GL_Cull函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 );
}
示例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();
}
示例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;
}
}
示例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 );
}
示例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;
}
示例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 );
}
示例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);
}
示例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();
}
示例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 ();
}
示例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 );
}
示例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;
}
示例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 );
}
示例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 );
}
}
示例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;
}
示例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 );
}