本文整理汇总了C++中qglScissor函数的典型用法代码示例。如果您正苦于以下问题:C++ qglScissor函数的具体用法?C++ qglScissor怎么用?C++ qglScissor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglScissor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDC
void idGLWidget::OnPaint()
{
if (!initialized)
{
CDC *dc = GetDC();
QEW_SetupPixelFormat(dc->m_hDC);
ReleaseDC(dc);
initialized = true;
}
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(rect);
if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC))
{
}
qglViewport(0, 0, rect.Width(), rect.Height());
qglScissor(0, 0, rect.Width(), rect.Height());
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity();
qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
qglDisable(GL_DEPTH_TEST);
qglDisable(GL_BLEND);
qglOrtho(0, rect.Width(), 0, rect.Height(), -256, 256);
if (drawable)
{
drawable->draw(1, 1, rect.Width()-1, rect.Height()-1);
}
else
{
qglViewport(0, 0, rect.Width(), rect.Height());
qglScissor(0, 0, rect.Width(), rect.Height());
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity();
qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
qwglSwapBuffers(dc);
qglFlush();
qwglMakeCurrent(win32.hDC, win32.hGLRC);
}
示例2: 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
qglDisable(GL_CULL_FACE);
qglDisable(GL_CLIP_PLANE0);
// set time for 2D shaders
backEnd.refdef.time = ri.Milliseconds();
backEnd.refdef.floatTime = backEnd.refdef.time * 0.001f;
}
示例3: 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();
}
示例4: RB_SetDefaultGLState
/*
======================
RB_SetDefaultGLState
This should initialize all GL state that any part of the entire program
may touch, including the editor.
======================
*/
void RB_SetDefaultGLState( void ) {
int i;
RB_LogComment( "--- R_SetDefaultGLState ---\n" );
qglClearDepth( 1.0f );
qglColor4f (1,1,1,1);
// the vertex array is always enabled
qglEnableClientState( GL_VERTEX_ARRAY );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglDisableClientState( GL_COLOR_ARRAY );
//
// make sure our GL state vector is set correctly
//
memset( &backEnd.glState, 0, sizeof( backEnd.glState ) );
backEnd.glState.forceGlState = true;
qglColorMask( 1, 1, 1, 1 );
qglEnable( GL_DEPTH_TEST );
qglEnable( GL_BLEND );
qglEnable( GL_SCISSOR_TEST );
qglEnable( GL_CULL_FACE );
qglDisable( GL_LIGHTING );
qglDisable( GL_LINE_STIPPLE );
qglDisable( GL_STENCIL_TEST );
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDepthFunc( GL_ALWAYS );
qglCullFace( GL_FRONT_AND_BACK );
qglShadeModel( GL_SMOOTH );
if ( r_useScissor.GetBool() ) {
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
}
for ( i = glConfig.maxTextureUnits - 1 ; i >= 0 ; i-- ) {
GL_SelectTexture( i );
// object linear texgen is our default
qglTexGenf( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
qglTexGenf( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
qglTexGenf( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
qglTexGenf( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
if ( glConfig.texture3DAvailable ) {
qglDisable( GL_TEXTURE_3D );
}
if ( glConfig.cubeMapAvailable ) {
qglDisable( GL_TEXTURE_CUBE_MAP_EXT );
}
}
}
示例5: RB_ApplyScissor
/*
* RB_ApplyScissor
*/
void RB_ApplyScissor( void )
{
int h = rb.gl.scissor[3];
if( rb.gl.scissorChanged ) {
rb.gl.scissorChanged = false;
qglScissor( rb.gl.scissor[0], rb.gl.fbHeight - h - rb.gl.scissor[1], rb.gl.scissor[2], h );
}
}
示例6: SetViewportAndScissor
static void SetViewportAndScissor( void ) {
GL_SetProjectionMatrix( backEnd.viewParms.projectionMatrix );
// set the window clipping
qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
示例7: RB_Scissor
/*
* RB_Scissor
*/
void RB_Scissor( int x, int y, int w, int h )
{
qglScissor( x, rb.gl.fbHeight - h - y, w, h );
rb.gl.scissor[0] = x;
rb.gl.scissor[1] = y;
rb.gl.scissor[2] = w;
rb.gl.scissor[3] = h;
}
示例8: 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 );
}
示例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: SetViewportAndScissor
void SetViewportAndScissor( void ) {
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
qglMatrixMode(GL_MODELVIEW);
// set the window clipping
qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
示例11: SetViewportAndScissor
static void SetViewportAndScissor( void ) {
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf( backEnd.viewParms.projectionMatrix );
qglMatrixMode(GL_MODELVIEW);
// set the window clipping
qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
if(r_subviewScissor->integer)
{
qglScissor( backEnd.viewParms.scissorMinX, backEnd.viewParms.scissorMinY,
backEnd.viewParms.scissorMaxX - backEnd.viewParms.scissorMinX,
backEnd.viewParms.scissorMaxY - backEnd.viewParms.scissorMinY );
}
else
{
qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
}
示例12: qglPushAttrib
void idGLDrawableConsole::draw(int x, int y, int w, int h) {
qglPushAttrib( GL_ALL_ATTRIB_BITS );
qglClearColor( 0.1f, 0.1f, 0.1f, 0.0f );
qglScissor( 0, 0, w, h );
qglClear( GL_COLOR_BUFFER_BIT );
renderSystem->BeginFrame( w, h );
console->Draw( true );
renderSystem->EndFrame( NULL, NULL );
qglPopAttrib();
}
示例13: RB_STD_FogAllLights
/*
==================
RB_STD_FogAllLights
==================
*/
void RB_STD_FogAllLights( void ) {
viewLight_t *vLight;
if ( r_skipFogLights.GetBool() || r_showOverDraw.GetInteger() != 0
|| backEnd.viewDef->isXraySubview /* dont fog in xray mode*/
) {
return;
}
qglDisable( GL_STENCIL_TEST );
for ( vLight = backEnd.viewDef->viewLights ; vLight ; vLight = vLight->next ) {
backEnd.vLight = vLight;
if ( !vLight->lightShader->IsFogLight() && !vLight->lightShader->IsBlendLight() ) {
continue;
}
#if 0 // _D3XP disabled that
if ( r_ignore.GetInteger() ) {
// we use the stencil buffer to guarantee that no pixels will be
// double fogged, which happens in some areas that are thousands of
// units from the origin
backEnd.currentScissor = vLight->scissorRect;
if ( r_useScissor.GetBool() ) {
qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 );
}
qglClear( GL_STENCIL_BUFFER_BIT );
qglEnable( GL_STENCIL_TEST );
// only pass on the cleared stencil values
qglStencilFunc( GL_EQUAL, 128, 255 );
// when we pass the stencil test and depth test and are going to draw,
// increment the stencil buffer so we don't ever draw on that pixel again
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
}
#endif
if ( vLight->lightShader->IsFogLight() ) {
RB_FogPass( vLight->globalInteractions, vLight->localInteractions );
} else if ( vLight->lightShader->IsBlendLight() ) {
RB_BlendLight( vLight->globalInteractions, vLight->localInteractions );
}
qglDisable( GL_STENCIL_TEST );
}
qglEnable( GL_STENCIL_TEST );
}
示例14: GL_Scissor
/*
==================
GL_Scissor
==================
*/
void GL_Scissor (rect_t rect){
if (glState.scissorX == rect.x && glState.scissorY == rect.y && glState.scissorWidth == rect.width && glState.scissorHeight == rect.height)
return;
glState.scissorX = rect.x;
glState.scissorY = rect.y;
glState.scissorWidth = rect.width;
glState.scissorHeight = rect.height;
qglScissor(rect.x, rect.y, rect.width, rect.height);
}
示例15: RB_RenderViewLight
/*
==================
RB_RenderViewLight
==================
*/
static void RB_RenderViewLight(viewLight_t *vLight)
{
backEnd.vLight = vLight;
// do fogging later
if (vLight->lightShader->IsFogLight()) {
return;
}
if (vLight->lightShader->IsBlendLight()) {
return;
}
RB_LogComment("---------- RB_RenderViewLight 0x%p ----------\n", vLight);
// clear the stencil buffer if needed
if (vLight->globalShadows || vLight->localShadows) {
backEnd.currentScissor = vLight->scissorRect;
if (r_useScissor.GetBool()) {
qglScissor(backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1);
}
qglClear(GL_STENCIL_BUFFER_BIT);
} else {
// no shadows, so no need to read or write the stencil buffer
// we might in theory want to use GL_ALWAYS instead of disabling
// completely, to satisfy the invarience rules
qglStencilFunc(GL_ALWAYS, 128, 255);
}
backEnd.depthFunc = GLS_DEPTHFUNC_EQUAL;
RB_StencilShadowPass(vLight->globalShadows);
RB_CreateDrawInteractions(vLight->localInteractions);
RB_StencilShadowPass(vLight->localShadows);
RB_CreateDrawInteractions(vLight->globalInteractions);
if (r_skipTranslucent.GetBool()) {
return;
}
// disable stencil testing for translucent interactions, because
// the shadow isn't calculated at their point, and the shadow
// behind them may be depth fighting with a back side, so there
// isn't any reasonable thing to do
qglStencilFunc(GL_ALWAYS, 128, 255);
backEnd.depthFunc = GLS_DEPTHFUNC_LESS;
RB_CreateDrawInteractions(vLight->translucentInteractions);
}