本文整理汇总了C++中qglDepthMask函数的典型用法代码示例。如果您正苦于以下问题:C++ qglDepthMask函数的具体用法?C++ qglDepthMask怎么用?C++ qglDepthMask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglDepthMask函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Draw_Char
/*
* ================ Draw_Char
*
* Draws one 8*8 graphics character with 0 being transparent. It can be clipped
* to the top of the screen to allow the console to be smoothly scrolled off.
* ================
*/
void
Draw_Char(int x, int y, int num, int alpha)
{
int row, col;
float frow, fcol, size;
num &= 255;
if (alpha >= 254)
alpha = 254;
else if (alpha <= 1)
alpha = 1;
if ((num & 127) == 32)
return; /* space */
if (y <= -8)
return; /* totally off screen */
row = num >> 4;
col = num & 15;
frow = row * 0.0625;
fcol = col * 0.0625;
size = 0.0625;
{
/* GLSTATE_DISABLE_ALPHATEST */
qglDisable(GL_ALPHA_TEST);
GL_TexEnv(GL_MODULATE);
qglColor4ub(255, 255, 255, alpha);
/* GLSTATE_ENABLE_BLEND */
qglEnable(GL_BLEND);
qglDepthMask(false);
}
GL_Bind(draw_chars->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(fcol, frow);
qglVertex2f(x, y);
qglTexCoord2f(fcol + size, frow);
qglVertex2f(x + 8, y);
qglTexCoord2f(fcol + size, frow + size);
qglVertex2f(x + 8, y + 8);
qglTexCoord2f(fcol, frow + size);
qglVertex2f(x, y + 8);
qglEnd();
{
qglDepthMask(true);
GL_TexEnv(GL_REPLACE);
/* GLSTATE_DISABLE_BLEND */
qglDisable(GL_BLEND);
qglColor4f(1,1,1,1);
/* GLSTATE_ENABLE_ALPHATEST */
qglEnable(GL_ALPHA_TEST);
}
}
开发者ID:ZwS,项目名称:qudos,代码行数:66,代码来源:gl_draw.c
示例2: Draw_StretchPic
/*
* ============= Draw_StretchPic -- only used for drawing console...
* =============
*/
void
Draw_StretchPic(int x, int y, int w, int h, char *pic, float alpha)
{
image_t *gl;
gl = Draw_FindPic(pic);
if (!gl) {
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload();
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION))
&& !gl->has_alpha)
qglDisable(GL_ALPHA_TEST);
/* add alpha support */
if (gl->has_alpha || alpha < 1) {
qglDisable(GL_ALPHA_TEST);
GL_Bind(gl->texnum);
GL_TexEnv(GL_MODULATE);
qglColor4f(1, 1, 1, alpha);
qglEnable(GL_BLEND);
qglDepthMask(false);
} else
GL_Bind(gl->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(gl->sl, gl->tl);
qglVertex2f(x, y);
qglTexCoord2f(gl->sh, gl->tl);
qglVertex2f(x + w, y);
qglTexCoord2f(gl->sh, gl->th);
qglVertex2f(x + w, y + h);
qglTexCoord2f(gl->sl, gl->th);
qglVertex2f(x, y + h);
qglEnd();
/* add alpha support */
if (gl->has_alpha || alpha < 1) {
qglDepthMask(true);
GL_TexEnv(GL_REPLACE);
qglDisable(GL_BLEND);
qglColor4f(1, 1, 1, 1);
qglEnable(GL_ALPHA_TEST);
}
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION))
&& !gl->has_alpha)
qglEnable(GL_ALPHA_TEST);
}
开发者ID:ZwS,项目名称:qudos,代码行数:58,代码来源:gl_draw.c
示例3: Draw_Pic
/*
* ============= Draw_Pic =============
*/
void
Draw_Pic(int x, int y, char *pic, float alpha)
{
image_t *gl;
gl = Draw_FindPic(pic);
if (!gl) {
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload();
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglDisable(GL_ALPHA_TEST);
/* add alpha support */
{
qglDisable(GL_ALPHA_TEST);
qglBindTexture(GL_TEXTURE_2D, gl->texnum);
GL_TexEnv(GL_MODULATE);
qglColor4f(1, 1, 1, 0.999); /* need <1 for trans to work */
qglEnable(GL_BLEND);
qglDepthMask(false);
}
GL_Bind(gl->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(gl->sl, gl->tl);
qglVertex2f(x, y);
qglTexCoord2f(gl->sh, gl->tl);
qglVertex2f(x + gl->width, y);
qglTexCoord2f(gl->sh, gl->th);
qglVertex2f(x + gl->width, y + gl->height);
qglTexCoord2f(gl->sl, gl->th);
qglVertex2f(x, y + gl->height);
qglEnd();
/* add alpha support */
{
qglDepthMask(true);
GL_TexEnv(GL_REPLACE);
qglDisable(GL_BLEND);
qglColor4f(1, 1, 1, 1);
qglEnable(GL_ALPHA_TEST);
}
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglEnable(GL_ALPHA_TEST);
}
开发者ID:ZwS,项目名称:qudos,代码行数:56,代码来源:gl_draw.c
示例4: Gui_Render
void Gui_Render()
{
const text_shader_description *shader = renderer.shaderManager->getTextShader();
screenSize[0] = screen_info.w;
screenSize[1] = screen_info.h;
qglUseProgramObjectARB(shader->program);
qglUniform1iARB(shader->sampler, 0);
qglUniform2fvARB(shader->screenSize, 1, screenSize);
qglUniform1fARB(shader->colorReplace, 0.0f);
qglPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
qglPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT | GL_CLIENT_VERTEX_ARRAY_BIT);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglPolygonMode(GL_FRONT, GL_FILL);
qglFrontFace(GL_CCW);
qglEnable(GL_BLEND);
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
qglDisable(GL_ALPHA_TEST);
if(World_GetPlayer() && main_inventory_manager)
{
Gui_DrawInventory(engine_frame_time);
}
Gui_DrawNotifier(engine_frame_time);
qglUseProgramObjectARB(shader->program);
qglDepthMask(GL_FALSE);
qglPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
qglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if(screen_info.crosshair != 0)
{
Gui_DrawCrosshair();
}
Gui_DrawBars();
qglUniform1fARB(shader->colorReplace, 1.0f);
GLText_RenderStrings();
Con_Draw(engine_frame_time);
qglUniform1fARB(shader->colorReplace, 0.0f);
qglDepthMask(GL_TRUE);
qglPopClientAttrib();
qglPopAttrib();
}
开发者ID:teacoffee2017,项目名称:OpenTomb,代码行数:47,代码来源:gui.cpp
示例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.storedGlState = 0;
glState.faceCulling = CT_TWO_SIDED;
glState.faceCullFront = qtrue;
glState.currentProgram = 0;
qglUseProgramObjectARB(0);
if (glRefConfig.vertexArrayObject)
qglBindVertexArrayARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glState.currentVao = NULL;
glState.vertexAttribsEnabled = 0;
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 );
if (glRefConfig.seamlessCubeMap)
qglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// GL_POLYGON_OFFSET_FILL will be glEnable()d when this is used
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); // FIXME: get color of sky
}
开发者ID:openmoh,项目名称:ioq3,代码行数:62,代码来源:tr_init.c
示例6: 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 );
}
}
}
开发者ID:albertz,项目名称:iodoom3,代码行数:67,代码来源:tr_backend.cpp
示例7: 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
}
开发者ID:kboxsoft,项目名称:ioq3-ios,代码行数:61,代码来源:tr_init.c
示例8: 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 );
}
开发者ID:lrq3000,项目名称:openarena_engine,代码行数:60,代码来源:tr_init.c
示例9: GL_DepthMask
/*
==================
GL_DepthMask
==================
*/
void GL_DepthMask (bool mask){
if (glState.depthMask == mask)
return;
glState.depthMask = mask;
qglDepthMask(mask);
}
开发者ID:Mirrorman95,项目名称:quake-2-evolved,代码行数:14,代码来源:r_glState.c
示例10: Gui_DrawLoadScreen
void Gui_DrawLoadScreen(int value)
{
qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
qglPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
qglPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
qglPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
qglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
qglEnableClientState(GL_VERTEX_ARRAY);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglEnableClientState(GL_COLOR_ARRAY);
qglDisableClientState(GL_NORMAL_ARRAY);
qglEnable(GL_BLEND);
qglEnable(GL_TEXTURE_2D);
qglDisable(GL_ALPHA_TEST);
qglDepthMask(GL_FALSE);
qglPolygonMode(GL_FRONT, GL_FILL);
qglFrontFace(GL_CCW);
const GLfloat color_w[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const text_shader_description *shader = renderer.shaderManager->getTextShader();
screenSize[0] = screen_info.w;
screenSize[1] = screen_info.h;
qglUseProgramObjectARB(shader->program);
qglUniform1iARB(shader->sampler, 0);
qglUniform2fvARB(shader->screenSize, 1, screenSize);
Gui_DrawRect(0.0, 0.0, screen_info.w, screen_info.h, color_w, color_w, color_w, color_w, BM_OPAQUE, load_screen_tex);
if(value >= 0)
{
Bar[BAR_LOADING].Show(value);
}
qglDepthMask(GL_TRUE);
qglPopClientAttrib();
qglPopAttrib();
Engine_GLSwapWindow();
}
开发者ID:teacoffee2017,项目名称:OpenTomb,代码行数:41,代码来源:gui.cpp
示例11: 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 );
#ifdef _NPATCH
// If n-patches are supported, make sure they are disabled for now
// Set the initial tesselation level and the interpolation modes
if ( qglPNTrianglesiATI )
{
qglDisable( GL_PN_TRIANGLES_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_POINT_MODE_ATI, GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_NORMAL_MODE_ATI, GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI );
qglPNTrianglesiATI( GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, 3 );
}
#endif // _NPATCH
}
开发者ID:Ced2911,项目名称:massive-tyrion,代码行数:56,代码来源:tr_init.cpp
示例12: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearDepth( 1.0f );
qglCullFace(GL_FRONT);
qglColor4f (1,1,1,1);
GL_BindNullTextures();
if (glRefConfig.framebufferObject)
GL_BindNullFramebuffers();
qglEnable(GL_TEXTURE_2D);
GL_TextureMode( r_textureMode->string );
//qglShadeModel( GL_SMOOTH );
qglDepthFunc( GL_LEQUAL );
//
// make sure our GL state vector is set correctly
//
glState.glStateBits = GLS_DEPTHTEST_DISABLE | GLS_DEPTHMASK_TRUE;
glState.storedGlState = 0;
glState.faceCulling = CT_TWO_SIDED;
glState.faceCullFront = qtrue;
GL_BindNullProgram();
if (glRefConfig.vertexArrayObject)
qglBindVertexArray(0);
qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glState.currentVao = NULL;
glState.vertexAttribsEnabled = 0;
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 );
if (glRefConfig.seamlessCubeMap)
qglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// GL_POLYGON_OFFSET_FILL will be glEnable()d when this is used
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); // FIXME: get color of sky
}
开发者ID:lonkamikaze,项目名称:ioq3-freebsd,代码行数:55,代码来源:tr_init.c
示例13: 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;
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);
}
开发者ID:icanhas,项目名称:yantar,代码行数:55,代码来源:init.c
示例14: RB_MaskTessEnd
void RB_MaskTessEnd( void ) {
shaderCommands_t *input;
input = &tess;
//qglClear( GL_COLOR_BUFFER_BIT );
qglColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
qglDepthMask(GL_FALSE);
qglEnable(GL_STENCIL_TEST);
qglClearStencil(0);
qglClear(GL_STENCIL_BUFFER_BIT);
qglStencilFunc(GL_ALWAYS,1,1);
qglStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
tess.currentStageIteratorFunc();
qglDepthMask(GL_TRUE);
qglColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
qglStencilFunc(GL_EQUAL,1,1);
qglStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
}
开发者ID:redrumrobot,项目名称:quakeconstruct,代码行数:24,代码来源:tr_shade.c
示例15: 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;
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//*SEB* ? not the best place !
glLockArraysEXT = NULL;
glUnlockArraysEXT = NULL;
qglDepthMask(GL_TRUE);
qglDisable(GL_DEPTH_TEST);
qglEnable(GL_SCISSOR_TEST);
qglDisable(GL_CULL_FACE);
qglDisable(GL_BLEND);
}
开发者ID:fretn,项目名称:etlegacy,代码行数:50,代码来源:tr_init.c
示例16: RadiantRun
void RadiantRun( void ) {
static bool exceptionErr = false;
int show = ::IsWindowVisible(win32.hWnd);
try {
if (!exceptionErr && !show) {
//qglPushAttrib(GL_ALL_ATTRIB_BITS);
qglDepthMask(true);
theApp.Run();
//qglPopAttrib();
//qwglMakeCurrent(0, 0);
renderDevice->BindDeviceToWindow(win32.hDC);
}
}
catch( idException &ex ) {
::MessageBox(NULL, ex.error, "Exception error", MB_OK);
RadiantShutdown();
}
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:19,代码来源:Radiant.cpp
示例17: RB_SetGLDefaults
/*
* RB_SetGLDefaults
*/
static void RB_SetGLDefaults( void )
{
if( glConfig.stencilBits )
{
qglStencilMask( ( GLuint ) ~0 );
qglStencilFunc( GL_EQUAL, 128, 0xFF );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
}
qglDisable( GL_CULL_FACE );
qglFrontFace( GL_CCW );
qglDisable( GL_BLEND );
qglDepthFunc( GL_LEQUAL );
qglDepthMask( GL_FALSE );
qglDisable( GL_POLYGON_OFFSET_FILL );
qglPolygonOffset( -1.0f, 0.0f ); // units will be handled by RB_DepthOffset
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
qglEnable( GL_DEPTH_TEST );
#ifndef GL_ES_VERSION_2_0
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
#endif
qglFrontFace( GL_CCW );
}
开发者ID:cfr,项目名称:qfusion,代码行数:26,代码来源:r_backend.c
示例18: RB_SetState
//.........这里部分代码省略.........
case GLSTATE_DSTBLEND_SRC_ALPHA:
blenddst = GL_SRC_ALPHA;
break;
case GLSTATE_DSTBLEND_ONE_MINUS_SRC_ALPHA:
blenddst = GL_ONE_MINUS_SRC_ALPHA;
break;
case GLSTATE_DSTBLEND_DST_ALPHA:
blenddst = GL_DST_ALPHA;
break;
case GLSTATE_DSTBLEND_ONE_MINUS_DST_ALPHA:
blenddst = GL_ONE_MINUS_DST_ALPHA;
break;
default:
case GLSTATE_DSTBLEND_ZERO:
blenddst = GL_ZERO;
break;
}
if( !( rb.gl.state & GLSTATE_BLEND_MASK ) )
qglEnable( GL_BLEND );
qglBlendFuncSeparateEXT( blendsrc, blenddst, GL_ONE, GL_ONE );
}
else
{
qglDisable( GL_BLEND );
}
}
if( diff & (GLSTATE_NO_COLORWRITE|GLSTATE_ALPHAWRITE) )
{
if( state & GLSTATE_NO_COLORWRITE )
qglColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
else
qglColorMask( GL_TRUE, GL_TRUE, GL_TRUE, ( state & GLSTATE_ALPHAWRITE ) ? GL_TRUE : GL_FALSE );
}
if( diff & (GLSTATE_DEPTHFUNC_EQ|GLSTATE_DEPTHFUNC_GT) )
{
if( state & GLSTATE_DEPTHFUNC_EQ )
qglDepthFunc( GL_EQUAL );
else if( state & GLSTATE_DEPTHFUNC_GT )
qglDepthFunc( GL_GREATER );
else
qglDepthFunc( GL_LEQUAL );
}
if( diff & GLSTATE_DEPTHWRITE )
{
if( state & GLSTATE_DEPTHWRITE )
qglDepthMask( GL_TRUE );
else
qglDepthMask( GL_FALSE );
}
if( diff & GLSTATE_NO_DEPTH_TEST )
{
if( state & GLSTATE_NO_DEPTH_TEST )
qglDisable( GL_DEPTH_TEST );
else
qglEnable( GL_DEPTH_TEST );
}
if( diff & GLSTATE_OFFSET_FILL )
{
if( state & GLSTATE_OFFSET_FILL )
{
qglEnable( GL_POLYGON_OFFSET_FILL );
RB_DepthOffset( true );
}
else
{
qglDisable( GL_POLYGON_OFFSET_FILL );
RB_DepthOffset( false );
}
}
if( diff & GLSTATE_STENCIL_TEST )
{
if( glConfig.stencilBits )
{
if( state & GLSTATE_STENCIL_TEST )
qglEnable( GL_STENCIL_TEST );
else
qglDisable( GL_STENCIL_TEST );
}
}
if( diff & GLSTATE_ALPHATEST )
{
if( glConfig.ext.multisample ) {
if( state & GLSTATE_ALPHATEST )
qglEnable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB );
else
qglDisable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB );
}
}
rb.gl.state = state;
}
开发者ID:DenMSC,项目名称:qfusion,代码行数:101,代码来源:r_backend.c
示例19: GL_State
//.........这里部分代码省略.........
dstFactor = GL_SRC_COLOR;
break;
case GLS_DSTBLEND_ONE_MINUS_SRC_COLOR:
dstFactor = GL_ONE_MINUS_SRC_COLOR;
break;
case GLS_DSTBLEND_SRC_ALPHA:
dstFactor = GL_SRC_ALPHA;
break;
case GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA:
dstFactor = GL_ONE_MINUS_SRC_ALPHA;
break;
case GLS_DSTBLEND_DST_ALPHA:
dstFactor = GL_DST_ALPHA;
break;
case GLS_DSTBLEND_ONE_MINUS_DST_ALPHA:
dstFactor = GL_ONE_MINUS_DST_ALPHA;
break;
default:
ri.Error( ERR_DROP, "GL_State: invalid dst blend state bits" );
break;
}
qglBlendFunc( srcFactor, dstFactor );
}
}
//
// check depthmask
//
if ( diff & GLS_DEPTHMASK_TRUE )
{
if ( stateBits & GLS_DEPTHMASK_TRUE )
{
qglDepthMask( GL_TRUE );
}
else
{
qglDepthMask( GL_FALSE );
}
}
//
// fill/line mode
//
if ( diff & GLS_POLYMODE_LINE )
{
if ( stateBits & GLS_POLYMODE_LINE )
{
qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
else
{
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
}
//
// depthtest
//
if ( diff & GLS_DEPTHTEST_DISABLE )
{
if ( stateBits & GLS_DEPTHTEST_DISABLE )
{
qglDisable( GL_DEPTH_TEST );
}
else
开发者ID:openmoh,项目名称:ioq3,代码行数:67,代码来源:tr_backend.c
示例20: Draw_ScaledPic
void
Draw_ScaledPic(int x, int y, float scale, float alpha, char *pic, float red, float green, float blue, qboolean fixcoords, qboolean repscale)
{
float xoff, yoff;
image_t *gl;
gl = Draw_FindPic(pic);
if (!gl) {
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload();
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglDisable(GL_ALPHA_TEST);
/* add alpha support */
{
qglDisable(GL_ALPHA_TEST);
qglBindTexture(GL_TEXTURE_2D, gl->texnum);
GL_TexEnv(GL_MODULATE);
qglColor4f(red, green, blue, alpha);
qglEnable(GL_BLEND);
qglDepthMask(false);
}
/* NOTE: replace this with shaders as soon as they are supported */
if (repscale)
scale *= gl->replace_scale; /* scale down if replacing a pcx image */
if (fixcoords) { /* Knightmare- whether to adjust coordinates for scaling */
xoff = (gl->width * scale - gl->width) / 2;
yoff = (gl->height * scale - gl->height) / 2;
GL_Bind(gl->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(gl->sl, gl->tl);
qglVertex2f(x - xoff, y - yoff);
qglTexCoord2f(gl->sh, gl->tl);
qglVertex2f(x + gl->width + xoff, y - yoff);
qglTexCoord2f(gl->sh, gl->th);
qglVertex2f(x + gl->width + xoff, y + gl->height + yoff);
qglTexCoord2f(gl->sl, gl->th);
qglVertex2f(x - xoff, y + gl->height + yoff);
qglEnd();
} else {
xoff = gl->width * scale - gl->width;
yoff = gl->height * scale - gl->height;
GL_Bind(gl->texnum);
qglBegin(GL_QUADS);
qglTexCoord2f(gl->sl, gl->tl);
qglVertex2f(x, y);
qglTexCoord2f(gl->sh, gl->tl);
qglVertex2f(x + gl->width + xoff, y);
qglTexCoord2f(gl->sh, gl->th);
qglVertex2f(x + gl->width + xoff, y + gl->height + yoff);
qglTexCoord2f(gl->sl, gl->th);
qglVertex2f(x, y + gl->height + yoff);
qglEnd();
}
/* add alpha support */
{
qglDepthMask(true);
GL_TexEnv(GL_REPLACE);
qglDisable(GL_BLEND);
qglColor4f(1, 1, 1, 1);
qglEnable(GL_ALPHA_TEST);
}
if (((gl_config.renderer == GL_RENDERER_MCD) || (gl_config.renderer & GL_RENDERER_RENDITION)) && !gl->has_alpha)
qglEnable(GL_ALPHA_TEST);
}
开发者ID:ZwS,项目名称:qudos,代码行数:80,代码来源:gl_draw.c
注:本文中的qglDepthMask函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论