本文整理汇总了C++中qglShadeModel函数的典型用法代码示例。如果您正苦于以下问题:C++ qglShadeModel函数的具体用法?C++ qglShadeModel怎么用?C++ qglShadeModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglShadeModel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: R_SetDefaultState
void
R_SetDefaultState(void)
{
qglClearColor(1, 0, 0.5, 0.5);
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666);
qglDisable(GL_DEPTH_TEST);
qglDisable(GL_CULL_FACE);
qglDisable(GL_BLEND);
qglColor4f(1, 1, 1, 1);
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglShadeModel(GL_FLAT);
R_TextureMode(gl_texturemode->string);
R_TextureAlphaMode(gl_texturealphamode->string);
R_TextureSolidMode(gl_texturesolidmode->string);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
R_TexEnv(GL_REPLACE);
if (qglPointParameterfEXT)
{
float attenuations[3];
attenuations[0] = gl_particle_att_a->value;
attenuations[1] = gl_particle_att_b->value;
attenuations[2] = gl_particle_att_c->value;
/* GL_POINT_SMOOTH is not implemented by some OpenGL
drivers, especially the crappy Mesa3D backends like
i915.so. That the points are squares and not circles
is not a problem by Quake II! */
qglEnable(GL_POINT_SMOOTH);
qglPointParameterfEXT(GL_POINT_SIZE_MIN_EXT,
gl_particle_min_size->value);
qglPointParameterfEXT(GL_POINT_SIZE_MAX_EXT,
gl_particle_max_size->value);
qglPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, attenuations);
}
if (qglColorTableEXT && gl_ext_palettedtexture->value)
{
qglEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
R_SetTexturePalette(d_8to24table);
}
}
示例2: 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 );
}
}
}
示例3: 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
}
示例4: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
//qglClearColor (1,0, 0.5 , 0.5); // NeVo - fucking ugly color!
qglClearColor (0,0,0,1); // NeVo - clear to black
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666);
qglDisable (GL_DEPTH_TEST);
qglDisable (GL_CULL_FACE);
qglDisable (GL_BLEND);
qglColor4f (1,1,1,1);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglShadeModel (GL_FLAT);
GL_TextureMode( gl_texturemode->string );
GL_TextureAlphaMode( gl_texturealphamode->string );
GL_TextureSolidMode( gl_texturesolidmode->string );
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv( GL_REPLACE );
if ( qglPointParameterfEXT )
{
float attenuations[3];
attenuations[0] = gl_particle_att_a->value;
attenuations[1] = gl_particle_att_b->value;
attenuations[2] = gl_particle_att_c->value;
qglEnable( GL_POINT_SMOOTH );
qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value );
qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value );
qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations );
}
if ( qglColorTableEXT && gl_ext_palettedtexture->value )
{
qglEnable( GL_SHARED_TEXTURE_PALETTE_EXT );
GL_SetTexturePalette( d_8to24table );
}
GL_UpdateSwapInterval();
}
示例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 );
// 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
}
示例6: 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);
}
示例7: GL_SetDefaultState
/*
** GL_SetDefaultState
*/
void GL_SetDefaultState( void )
{
qglClearColor (1.0f, 0.0f, 0.5f, 0.5f);
qglCullFace(GL_FRONT);
qglEnable(GL_TEXTURE_2D);
qglEnable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.666f);
qglDisable (GL_DEPTH_TEST);
qglDisable (GL_CULL_FACE);
qglDisable (GL_BLEND);
qglColor4fv(colorWhite);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglShadeModel (GL_FLAT);
GL_TextureMode( gl_texturemode->string );
GL_TextureAlphaMode( gl_texturealphamode->string );
GL_TextureSolidMode( gl_texturesolidmode->string );
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv( GL_REPLACE );
if ( qglPointParameterfEXT && FLOAT_NE_ZERO(gl_ext_pointparameters->value))
{
float attenuations[3];
attenuations[0] = gl_particle_att_a->value;
attenuations[1] = gl_particle_att_b->value;
attenuations[2] = gl_particle_att_c->value;
qglEnable( GL_POINT_SMOOTH );
qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value );
qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value );
qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations );
}
gl_swapinterval->modified = true;
GL_UpdateSwapInterval();
}
示例8: qglMatrixMode
void CMistyFog2::Render(CWorldEffectsSystem *system)
{
if (mFadeAlpha <= 0.0)
{
return;
}
qglMatrixMode(GL_PROJECTION);
qglPushMatrix();
qglLoadIdentity ();
MYgluPerspective (80.0, 1.0, 4, 2048.0);
qglMatrixMode(GL_MODELVIEW);
qglPushMatrix();
qglLoadIdentity ();
qglRotatef (-90, 1, 0, 0); // put Z going up
qglRotatef (90, 0, 0, 1); // put Z going up
qglRotatef (0, 1, 0, 0);
qglRotatef (-90, 0, 1, 0);
qglRotatef (-90, 0, 0, 1);
qglDisable(GL_TEXTURE_2D);
GL_State(GLS_SRCBLEND_SRC_ALPHA|GLS_DSTBLEND_ONE);
qglShadeModel (GL_SMOOTH);
qglColorPointer(4, GL_FLOAT, 0, mColors);
qglEnableClientState(GL_COLOR_ARRAY);
qglVertexPointer( 3, GL_FLOAT, 0, mVerts );
qglEnableClientState(GL_VERTEX_ARRAY);
if (qglLockArraysEXT)
{
qglLockArraysEXT(0, MISTYFOG_HEIGHT*MISTYFOG_WIDTH);
}
qglDrawElements(GL_QUADS, (MISTYFOG_HEIGHT-1)*(MISTYFOG_WIDTH-1)*4, GL_UNSIGNED_INT, mIndexes);
if ( qglUnlockArraysEXT )
{
qglUnlockArraysEXT();
}
qglDisableClientState(GL_COLOR_ARRAY);
// qglDisableClientState(GL_VERTEX_ARRAY); backend doesn't ever re=enable this properly
qglPopMatrix();
qglMatrixMode(GL_PROJECTION);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW); // bug somewhere in the backend which requires this
}
示例9: 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);
}
示例10: R_DrawAliasModel
//.........这里部分代码省略.........
qglLoadIdentity();
qglScalef( -1, 1, 1 );
MYgluPerspective( r_newrefdef.fov_y, ( float ) r_newrefdef.width / r_newrefdef.height, 4, 4096);
qglMatrixMode( GL_MODELVIEW );
qglCullFace( GL_BACK );
}
qglPushMatrix ();
e->angles[PITCH] = -e->angles[PITCH]; // sigh.
R_RotateForEntity (e);
e->angles[PITCH] = -e->angles[PITCH]; // sigh.
// select skin
if (currententity->skin)
skin = currententity->skin; // custom player skin
else
{
if (currententity->skinnum >= MAX_MD2SKINS)
skin = currentmodel->skins[0];
else
{
skin = currentmodel->skins[currententity->skinnum];
if (!skin)
skin = currentmodel->skins[0];
}
}
if (!skin)
skin = r_notexture; // fallback...
GL_Bind(skin->texnum);
// draw it
qglShadeModel (GL_SMOOTH);
GL_TexEnv( GL_MODULATE );
if ( currententity->flags & RF_TRANSLUCENT )
{
qglEnable (GL_BLEND);
}
if ( (currententity->frame >= paliashdr->num_frames)
|| (currententity->frame < 0) )
{
ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n",
currentmodel->name, currententity->frame);
currententity->frame = 0;
currententity->oldframe = 0;
}
if ( (currententity->oldframe >= paliashdr->num_frames)
|| (currententity->oldframe < 0))
{
ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n",
currentmodel->name, currententity->oldframe);
currententity->frame = 0;
currententity->oldframe = 0;
}
if ( !r_lerpmodels->value )
currententity->backlerp = 0;
GL_DrawAliasFrameLerp (paliashdr, currententity->backlerp);
GL_TexEnv( GL_REPLACE );
qglShadeModel (GL_FLAT);
示例11: RB_StageIteratorLightmappedMultitexture
void RB_StageIteratorLightmappedMultitexture( void ) {
shaderCommands_t *input;
shader_t *shader;
input = &tess;
shader = input->shader;
//
// 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 face culling appropriately
//
GL_Cull( 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, 16, tess.texCoords[0][0] );
//
// configure second stage
//
GL_SelectTexture( 1 );
qglEnable( GL_TEXTURE_2D );
if ( r_lightmap->integer ) {
GL_TexEnv( GL_REPLACE );
} else {
GL_TexEnv( GL_MODULATE );
}
R_BindAnimatedImage( &tess.xstages[0]->bundle[1] );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 16, tess.texCoords[0][1] );
//
// 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 ) {
ProjectDlightTexture();
}
//
// now do fog
//
if ( tess.fogNum && tess.shader->fogPass ) {
RB_FogPass();
}
//
// unlock arrays
//
if ( qglUnlockArraysEXT ) {
qglUnlockArraysEXT();
//.........这里部分代码省略.........
示例12: GL_SetDefaultState
//.........这里部分代码省略.........
qglActiveTexture(GL_TEXTURE0 + i);
qglMatrixMode(GL_TEXTURE);
qglLoadIdentity();
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_TEXTURE_3D);
qglDisable(GL_TEXTURE_CUBE_MAP);
qglDisable(GL_TEXTURE_2D_ARRAY);
qglBindTexture(GL_TEXTURE_2D, 0);
qglBindTexture(GL_TEXTURE_3D, 0);
qglBindTexture(GL_TEXTURE_CUBE_MAP, 0);
qglBindTexture(GL_TEXTURE_2D_ARRAY, 0);
qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qglDisable(GL_TEXTURE_GEN_S);
qglDisable(GL_TEXTURE_GEN_T);
qglDisable(GL_TEXTURE_GEN_R);
qglDisable(GL_TEXTURE_GEN_Q);
qglTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
qglTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
qglTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
qglTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
}
qglDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
qglUseProgram(0);
qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglViewport(0, 0, glConfig.videoWidth, glConfig.videoHeight);
qglEnable(GL_SCISSOR_TEST);
qglScissor(0, 0, glConfig.videoWidth, glConfig.videoHeight);
qglEnable(GL_DEPTH_BOUNDS_TEST_EXT);
qglDepthBoundsEXT(0.0f, 1.0f);
qglFrontFace(GL_CCW);
qglShadeModel(GL_SMOOTH);
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglDisable(GL_CULL_FACE);
qglCullFace(GL_FRONT);
qglDisable(GL_POLYGON_OFFSET_FILL);
qglDisable(GL_POLYGON_OFFSET_LINE);
qglPolygonOffset(0.0f, 0.0f);
qglDisable(GL_BLEND);
qglBlendFunc(GL_ONE, GL_ZERO);
qglBlendEquation(GL_FUNC_ADD);
qglDisable(GL_ALPHA_TEST);
qglAlphaFunc(GL_GREATER, 0.0f);
qglDisable(GL_DEPTH_TEST);
qglDepthFunc(GL_LEQUAL);
qglDisable(GL_STENCIL_TEST);
qglStencilFunc(GL_ALWAYS, 128, 255);
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
qglDepthRange(0.0f, 1.0f);
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
qglDepthMask(GL_TRUE);
qglStencilMask(255);
qglDisable(GL_DEPTH_CLAMP);
qglDisable(GL_CLIP_PLANE0);
if (glConfig.multiSamples > 1){
qglDisable(GL_MULTISAMPLE);
qglDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
qglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
qglClearDepth(1.0f);
qglClearStencil(128);
qglEnableClientState(GL_VERTEX_ARRAY);
qglDisableVertexAttribArray(GL_ATTRIB_NORMAL);
qglDisableVertexAttribArray(GL_ATTRIB_TANGENT1);
qglDisableVertexAttribArray(GL_ATTRIB_TANGENT2);
qglDisableVertexAttribArray(GL_ATTRIB_TEXCOORD);
qglDisableVertexAttribArray(GL_ATTRIB_COLOR);
QGL_LogPrintf("--------------------\n");
}
示例13: fopen
//.........这里部分代码省略.........
//if (m_Camera.draw_mode == cd_light)
//{
// if (g_PrefsDlg.m_bGLLighting)
// {
// VectorCopy(m_Camera.origin, lightPos);
// lightPos[3] = 1;
// qglLightfv(GL_LIGHT0, GL_POSITION, lightPos);
// }
//}
InitCull ();
//
// draw stuff
//
GLfloat lAmbient[] = {1.0, 1.0, 1.0, 1.0};
switch (m_Camera.draw_mode)
{
case cd_wire:
qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_TEXTURE_1D);
qglDisable(GL_BLEND);
qglDisable(GL_DEPTH_TEST);
qglColor3f(1.0, 1.0, 1.0);
// qglEnable (GL_LINE_SMOOTH);
break;
case cd_solid:
qglCullFace(GL_FRONT);
qglEnable(GL_CULL_FACE);
qglShadeModel (GL_FLAT);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_BLEND);
qglEnable(GL_DEPTH_TEST);
qglDepthFunc (GL_LEQUAL);
break;
case cd_texture:
qglCullFace(GL_FRONT);
qglEnable(GL_CULL_FACE);
qglShadeModel (GL_FLAT);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglEnable(GL_TEXTURE_2D);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglDisable(GL_BLEND);
qglEnable(GL_DEPTH_TEST);
qglDepthFunc (GL_LEQUAL);
break;
case cd_blend:
qglCullFace(GL_FRONT);
qglEnable(GL_CULL_FACE);
qglShadeModel (GL_FLAT);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglEnable(GL_TEXTURE_2D);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
qglDisable(GL_DEPTH_TEST);
qglEnable (GL_BLEND);
示例14: Z_Draw
/*
==============
Z_Draw
==============
*/
void Z_Draw (void)
{
brush_t *brush;
float w, h;
double start, end;
qtexture_t *q;
float top, bottom;
vec3_t org_top, org_bottom, dir_up, dir_down;
int xCam = z.width/3;
if (!active_brushes.next)
return; // not valid yet
if (z.timing)
start = Sys_DoubleTime ();
//
// clear
//
qglViewport(0, 0, z.width, z.height);
qglClearColor (
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][0],
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][1],
g_qeglobals.d_savedinfo.colors[COLOR_GRIDBACK][2],
0);
/* GL Bug */
/* When not using hw acceleration, gl will fault if we clear the depth
buffer bit on the first pass. The hack fix is to set the GL_DEPTH_BUFFER_BIT
only after Z_Draw() has been called once. Yeah, right. */
qglClear(glbitClear);
glbitClear |= GL_DEPTH_BUFFER_BIT;
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
w = z.width/2 / z.scale;
h = z.height/2 / z.scale;
qglOrtho (-w, w, z.origin[2]-h, z.origin[2]+h, -8, 8);
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_TEXTURE_1D);
qglDisable(GL_DEPTH_TEST);
qglDisable(GL_BLEND);
//
// now draw the grid
//
Z_DrawGrid ();
//
// draw stuff
//
qglDisable(GL_CULL_FACE);
qglShadeModel (GL_FLAT);
qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_BLEND);
qglDisable(GL_DEPTH_TEST);
// draw filled interiors and edges
dir_up[0] = 0 ; dir_up[1] = 0; dir_up[2] = 1;
dir_down[0] = 0 ; dir_down[1] = 0; dir_down[2] = -1;
VectorCopy (z.origin, org_top);
org_top[2] = MAX_WORLD_COORD;//4096; // MAX_WORLD_COORD ? (John said this didn't work, Hmmmmmm) // !suspect!
VectorCopy (z.origin, org_bottom);
org_bottom[2] = MIN_WORLD_COORD;//-4096; // MIN_WORLD_COORD? " " !suspect!
for (brush = active_brushes.next ; brush != &active_brushes ; brush=brush->next)
{
if (brush->mins[0] >= z.origin[0]
|| brush->maxs[0] <= z.origin[0]
|| brush->mins[1] >= z.origin[1]
|| brush->maxs[1] <= z.origin[1])
continue;
if (!Brush_Ray (org_top, dir_down, brush, &top))
continue;
top = org_top[2] - top;
if (!Brush_Ray (org_bottom, dir_up, brush, &bottom))
continue;
bottom = org_bottom[2] + bottom;
q = Texture_ForName (brush->brush_faces->texdef.name);
qglColor3f (q->color[0], q->color[1], q->color[2]);
qglBegin (GL_QUADS);
qglVertex2f (-xCam, bottom);
qglVertex2f (xCam, bottom);
//.........这里部分代码省略.........
示例15: 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();
}
//.........这里部分代码省略.........