本文整理汇总了C++中qglDrawBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ qglDrawBuffer函数的具体用法?C++ qglDrawBuffer怎么用?C++ qglDrawBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglDrawBuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GLimp_BeginFrame
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( float camera_separation )
{
if ( gl_bitdepth->modified )
{
if ( gl_bitdepth->value != 0 && !glw_state.allowdisplaydepthchange )
{
ri.Cvar_SetValue( "gl_bitdepth", 0 );
ri.Con_Printf( PRINT_ALL, "gl_bitdepth requires Win95 OSR2.x or WinNT 4.x\n" );
}
gl_bitdepth->modified = false;
}
if ( camera_separation < 0 && gl_state.stereo_enabled )
{
qglDrawBuffer( GL_BACK_LEFT );
}
else if ( camera_separation > 0 && gl_state.stereo_enabled )
{
qglDrawBuffer( GL_BACK_RIGHT );
}
else
{
qglDrawBuffer( GL_BACK );
}
}
示例2: GLimp_BeginFrame
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( void )
{
if( r_colorbits->modified )
{
if( r_colorbits->integer != 0 && !glw_state.allowdisplaydepthchange )
{
Cvar_SetValue( "r_colorbits", 0 );
Com_Printf( "r_colorbits requires Win95 OSR2.x or WinNT 4.x\n" );
}
r_colorbits->modified = qfalse;
}
if( glState.cameraSeparation < 0 && glState.stereoEnabled )
{
qglDrawBuffer( GL_BACK_LEFT );
}
else if( glState.cameraSeparation > 0 && glState.stereoEnabled )
{
qglDrawBuffer( GL_BACK_RIGHT );
}
else
{
qglDrawBuffer( GL_BACK );
}
}
示例3: GetWindowRect
void CCamWnd::BenchMark()
{
PAINTSTRUCT ps;
CRect rct;
GetWindowRect(rct);
long lStyle = ::GetWindowLong(GetSafeHwnd(), GWL_STYLE);
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, QE3_CHILDSTYLE);
CWnd* pParent = GetParent();
SetParent(g_pParentWnd);
MoveWindow(CRect(30, 30, 400, 400), TRUE);
BeginPaint(&ps);
if (!qwglMakeCurrent(ps.hdc, g_qeglobals.d_hglrcBase))
Error ("wglMakeCurrent failed in Benchmark");
qglDrawBuffer (GL_FRONT);
double dStart = Sys_DoubleTime ();
for (int i=0 ; i < 100 ; i++)
{
m_Camera.angles[YAW] = i*4;
Cam_Draw();
}
qwglSwapBuffers(ps.hdc);
qglDrawBuffer (GL_BACK);
double dEnd = Sys_DoubleTime ();
EndPaint(&ps);
Sys_Printf ("%5.2f seconds\n", dEnd - dStart);
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, lStyle);
SetParent(pParent);
MoveWindow(rct, TRUE);
}
示例4: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
// the vertex array is always enabled, but the color and texture
// arrays are enabled and disabled around the compiled vertex array call
qglEnableClientState (GL_VERTEX_ARRAY);
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
qglClearDepth( 1.0 );
qglDrawBuffer( GL_FRONT );
#ifdef IOS
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#else
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#endif
qglDrawBuffer( GL_BACK );
#ifdef IOS
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#else
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
#endif
}
示例5: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
// initialize downstream texture unit if we're running
// in a multitexture environment
if ( qglActiveTextureARB ) {
GL_SelectTexture( 1 );
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture( 0 );
}
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
GL_TexEnv( GL_MODULATE );
//qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.vertexAttribsState = 0;
glState.vertexAttribPointersSet = 0;
glState.currentProgram = 0;
qglUseProgramObjectARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentVBO = NULL;
glState.currentIBO = NULL;
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDepthMask( GL_TRUE );
qglDisable( GL_DEPTH_TEST );
qglEnable( GL_SCISSOR_TEST );
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
qglClearDepth( 1.0 );
qglDrawBuffer( GL_FRONT );
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
qglDrawBuffer( GL_BACK );
qglClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT );
}
示例6: GLimp_BeginFrame
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( float camera_separation )
{
if (gl_state.stereo_enabled && camera_separation < 0)
qglDrawBuffer( GL_BACK_LEFT );
else if (gl_state.stereo_enabled && camera_separation > 0)
qglDrawBuffer( GL_BACK_RIGHT );
else
qglDrawBuffer( GL_BACK );
}
示例7: GLimp_BeginFrame
/*
** GLimp_BeginFrame
*/
void GLimp_BeginFrame( void )
{
if( glState.cameraSeparation < 0 && glState.stereoEnabled )
{
qglDrawBuffer( GL_BACK_LEFT );
}
else if( glState.cameraSeparation > 0 && glState.stereoEnabled )
{
qglDrawBuffer( GL_BACK_RIGHT );
}
else
{
qglDrawBuffer( GL_BACK );
}
}
示例8: RB_SetBuffer
/*
=============
RB_SetBuffer
=============
*/
static void RB_SetBuffer( const void *data ) {
const setBufferCommand_t *cmd;
// see which draw buffer we want to render the frame to
cmd = (const setBufferCommand_t *)data;
backEnd.frameCount = cmd->frameCount;
qglDrawBuffer( cmd->buffer );
// clear screen for debugging
// automatically enable this with several other debug tools
// that might leave unrendered portions of the screen
if ( r_clear.GetFloat() || idStr::Length( r_clear.GetString() ) != 1 || r_lockSurfaces.GetBool() || r_singleArea.GetBool() || r_showOverDraw.GetBool() ) {
float c[3];
if ( sscanf( r_clear.GetString(), "%f %f %f", &c[0], &c[1], &c[2] ) == 3 ) {
qglClearColor( c[0], c[1], c[2], 1 );
} else if ( r_clear.GetInteger() == 2 ) {
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
} else if ( r_showOverDraw.GetBool() ) {
qglClearColor( 1.0f, 1.0f, 1.0f, 1.0f );
} else {
qglClearColor( 0.4f, 0.0f, 0.25f, 1.0f );
}
qglClear( GL_COLOR_BUFFER_BIT );
}
}
示例9: GLRB_SetDrawBuffer
void GLRB_SetDrawBuffer( int buffer )
{
switch (buffer)
{
case DRAW_BUFFER_BACK:
qglDrawBuffer( GL_BACK );
break;
case DRAW_BUFFER_FRONT:
qglDrawBuffer( GL_FRONT );
break;
case DRAW_BUFFER_BACK_LEFT:
qglDrawBuffer( GL_BACK_LEFT );
break;
case DRAW_BUFFER_BACK_RIGHT:
qglDrawBuffer( GL_BACK_RIGHT );
break;
}
}
示例10: RB_DrawBuffer
/*
=============
RB_DrawBuffer
=============
*/
static void RB_DrawBuffer( const void *data ) {
const drawBufferCommand_t *cmd;
cmd = (const drawBufferCommand_t *)data;
qglDrawBuffer( cmd->buffer );
R_FrameBuffer_StartFrame();
// clear screen for debugging
if ( r_clear->integer ) {
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
}
示例11: qglDrawBuffer
/*
=============
RB_DrawBuffer
=============
*/
const void *RB_DrawBuffer( const void *data ) {
const drawBufferCommand_t *cmd;
cmd = (const drawBufferCommand_t *)data;
qglDrawBuffer( cmd->buffer );
// clear screen for debugging
if ( r_clear->integer ) {
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
return (const void *)(cmd + 1);
}
示例12: RFB_AttachTextureToObject
/*
* RFB_AttachTextureToObject
*/
void RFB_AttachTextureToObject( int object, image_t *texture )
{
r_fbo_t *fbo;
int attachment;
assert( object > 0 && object <= r_num_framebuffer_objects );
if( object <= 0 || object > r_num_framebuffer_objects ) {
return;
}
assert( texture != NULL );
if( !texture ) {
return;
}
fbo = r_framebuffer_objects + object - 1;
qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbo->objectID );
if( texture->flags & IT_DEPTH ) {
attachment = GL_DEPTH_ATTACHMENT_EXT;
fbo->depthTexture = texture;
} else {
attachment = GL_COLOR_ATTACHMENT0_EXT;
fbo->colorTexture = texture;
#ifndef GL_ES_VERSION_2_0
qglDrawBuffer( GL_COLOR_ATTACHMENT0_EXT );
qglReadBuffer( GL_COLOR_ATTACHMENT0_EXT );
#endif
}
texture->fbo = object;
// attach texture
qglFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, texture->texnum, 0 );
if( ( texture->flags & ( IT_DEPTH|IT_STENCIL ) ) == ( IT_DEPTH|IT_STENCIL ) ) {
qglFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, texture->texnum, 0 );
}
qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, r_bound_framebuffer_objectID ? r_bound_framebuffer_object->objectID : 0 );
}
示例13: qglDrawBuffer
/*
=============
RB_DrawBuffer
=============
*/
const void *RB_DrawBuffer( const void *data ) {
const drawBufferCommand_t *cmd;
cmd = (const drawBufferCommand_t *)data;
qglDrawBuffer( cmd->buffer );
// clear screen for debugging
if (tr.world && tr.world->globalFog != -1)
{
unsigned i = tr.world->fogs[tr.world->globalFog].colorInt;
qglClearColor( ( (byte *)&i )[0] / 255.0, ( (byte *)&i )[1] / 255.0, ( (byte *)&i )[2] / 255.0, 1.0 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
else if ( r_clear->integer ) {
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
return (const void *)(cmd + 1);
}
示例14: RB_EndSurface
/*
=============
RB_DrawBuffer
=============
*/
const void *RB_DrawBuffer( const void *data ) {
const drawBufferCommand_t *cmd;
cmd = (const drawBufferCommand_t *)data;
// finish any 2D drawing if needed
if(tess.numIndexes)
RB_EndSurface();
if (glRefConfig.framebufferObject)
FBO_Bind(NULL);
qglDrawBuffer( cmd->buffer );
// clear screen for debugging
if ( r_clear->integer ) {
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
return (const void *)(cmd + 1);
}
示例15: RE_BeginFrame
//.........这里部分代码省略.........
R_IssuePendingRenderCommands();
R_SetColorMappings();
}
// check for errors
if ( !r_ignoreGLErrors->integer ) {
int err;
R_IssuePendingRenderCommands();
if ( ( err = qglGetError() ) != GL_NO_ERROR ) {
ri.Error( ERR_FATAL, "RE_BeginFrame() - glGetError() failed (0x%x)!", err );
}
}
if (glConfig.stereoEnabled) {
if( !(cmd = R_GetCommandBuffer(sizeof(*cmd))) )
return;
cmd->commandId = RC_DRAW_BUFFER;
if ( stereoFrame == STEREO_LEFT ) {
cmd->buffer = (int)GL_BACK_LEFT;
} else if ( stereoFrame == STEREO_RIGHT ) {
cmd->buffer = (int)GL_BACK_RIGHT;
} else {
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
}
}
else
{
if(r_anaglyphMode->integer)
{
if(r_anaglyphMode->modified)
{
// clear both, front and backbuffer.
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
qglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
qglDrawBuffer(GL_FRONT);
qglClear(GL_COLOR_BUFFER_BIT);
qglDrawBuffer(GL_BACK);
qglClear(GL_COLOR_BUFFER_BIT);
r_anaglyphMode->modified = qfalse;
}
if(stereoFrame == STEREO_LEFT)
{
if( !(cmd = R_GetCommandBuffer(sizeof(*cmd))) )
return;
if( !(colcmd = R_GetCommandBuffer(sizeof(*colcmd))) )
return;
}
else if(stereoFrame == STEREO_RIGHT)
{
clearDepthCommand_t *cldcmd;
if( !(cldcmd = R_GetCommandBuffer(sizeof(*cldcmd))) )
return;
cldcmd->commandId = RC_CLEARDEPTH;
if( !(colcmd = R_GetCommandBuffer(sizeof(*colcmd))) )
return;
}
else
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
R_SetColorMode(colcmd->rgba, stereoFrame, r_anaglyphMode->integer);
colcmd->commandId = RC_COLORMASK;
}
else
{
if(stereoFrame != STEREO_CENTER)
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is disabled, but stereoFrame was %i", stereoFrame );
if( !(cmd = R_GetCommandBuffer(sizeof(*cmd))) )
return;
}
if(cmd)
{
cmd->commandId = RC_DRAW_BUFFER;
if(r_anaglyphMode->modified)
{
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
r_anaglyphMode->modified = qfalse;
}
if (!Q_stricmp(r_drawBuffer->string, "GL_FRONT"))
cmd->buffer = (int)GL_FRONT;
else
cmd->buffer = (int)GL_BACK;
}
}
tr.refdef.stereoFrame = stereoFrame;
}