本文整理汇总了C++中qglLockArraysEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ qglLockArraysEXT函数的具体用法?C++ qglLockArraysEXT怎么用?C++ qglLockArraysEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qglLockArraysEXT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawCel
//DRAWCEL
static void DrawCel (shaderCommands_t *input) {
GL_Bind( tr.whiteImage );
qglColor3f (1,1,1);
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
qglDisableClientState (GL_COLOR_ARRAY);
qglDisableClientState (GL_TEXTURE_COORD_ARRAY);
qglVertexPointer (3, GL_FLOAT, 16, input->xyz); // padded for SIMD
if (qglLockArraysEXT) {
qglLockArraysEXT(0, input->numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
R_DrawCel( input->numIndexes, input->indexes );
if (qglUnlockArraysEXT) {
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
}
示例2: DrawTris
/*
================
DrawTris
Draws triangle outlines for debugging
================
*/
static void DrawTris (shaderCommands_t *input) {
GL_Bind( tr.whiteImage );
qglColor3f (1,1,1);
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
qglDepthRange( 0, 0 );
qglDisableClientState (GL_COLOR_ARRAY);
qglDisableClientState (GL_TEXTURE_COORD_ARRAY);
qglVertexPointer (3, GL_FLOAT, 16, input->xyz); // padded for SIMD
if (qglLockArraysEXT) {
qglLockArraysEXT(0, input->numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
#ifdef HAVE_GLES
qglDrawElements( GL_LINE_STRIP,
input->numIndexes,
GL_INDEX_TYPE,
input->indexes );
#else
R_DrawElements( input->numIndexes, input->indexes );
#endif
if (qglUnlockArraysEXT) {
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
qglDepthRange( 0, 1 );
}
示例3: 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
}
示例4: RB_OutlinesPass
/*
===================
RB_OutlinesPass
Draws outlines on surfaces with shader.hasOutlines set
===================
*/
static void RB_OutlinesPass( void ) {
int outlines;
float outlinesAlpha;
outlines = r_outlines->value;
outlinesAlpha = r_outlinesAlpha->value;
if ( !tess.shader->hasOutlines )
return;
if ( !r_outlines->integer )
return;
GL_Bind( tr.whiteImage );
qglColor4f( 0, 0, 0, outlinesAlpha );
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
qglPolygonMode( GL_BACK, GL_LINE );
qglLineWidth( outlines + 1 );
qglCullFace( GL_BACK );
qglDisableClientState( GL_COLOR_ARRAY );
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
qglVertexPointer (3, GL_FLOAT, 16, tess.xyz); // padded for SIMD
if (qglLockArraysEXT) {
qglLockArraysEXT(0, tess.numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
R_DrawElements( tess.numIndexes, tess.indexes );
if (qglUnlockArraysEXT) {
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
// FIX: Must reset these manually or renderer will b0rk!
qglCullFace( GL_FRONT );
qglLineWidth( 1 );
}
示例5: qglFogf
void CQuickSpriteSystem::Flush(void)
{
if (mNextVert==0)
{
return;
}
/*
if (mUseFog && r_drawfog->integer == 2 &&
mFogIndex == tr.world->globalFog)
{ //enable hardware fog when we draw this thing if applicable -rww
fog_t *fog = tr.world->fogs + mFogIndex;
qglFogf(GL_FOG_MODE, GL_EXP2);
qglFogf(GL_FOG_DENSITY, logtestExp2 / fog->parms.depthForOpaque);
qglFogfv(GL_FOG_COLOR, fog->parms.color);
qglEnable(GL_FOG);
}
*/
//this should not be needed, since I just wait to disable fog for the surface til after surface sprites are done
//
// render the main pass
//
R_BindAnimatedImage( mTexBundle );
GL_State(mGLStateBits);
//
// set arrays and lock
//
qglTexCoordPointer( 2, GL_FLOAT, 0, mTextureCoords );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
qglEnableClientState( GL_COLOR_ARRAY);
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, mColors );
qglVertexPointer (3, GL_FLOAT, 16, mVerts);
if ( qglLockArraysEXT )
{
qglLockArraysEXT(0, mNextVert);
GLimp_LogComment( "glLockArraysEXT\n" );
}
qglDrawArrays(GL_QUADS, 0, mNextVert);
backEnd.pc.c_vertexes += mNextVert;
backEnd.pc.c_indexes += mNextVert;
backEnd.pc.c_totalIndexes += mNextVert;
//only for software fog pass (global soft/volumetric) -rww
if (mUseFog && (r_drawfog->integer != 2 || mFogIndex != tr.world->globalFog))
{
fog_t *fog = tr.world->fogs + mFogIndex;
//
// render the fog pass
//
GL_Bind( tr.fogImage );
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_DEPTHFUNC_EQUAL );
//
// set arrays and lock
//
qglTexCoordPointer( 2, GL_FLOAT, 0, mFogTextureCoords);
// qglEnableClientState( GL_TEXTURE_COORD_ARRAY); // Done above
qglDisableClientState( GL_COLOR_ARRAY );
qglColor4ubv((GLubyte *)&fog->colorInt);
// qglVertexPointer (3, GL_FLOAT, 16, mVerts); // Done above
qglDrawArrays(GL_QUADS, 0, mNextVert);
// Second pass from fog
backEnd.pc.c_totalIndexes += mNextVert;
}
//
// unlock arrays
//
if (qglUnlockArraysEXT)
{
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
mNextVert=0;
}
示例6: 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();
//.........这里部分代码省略.........
示例7: RB_StageIteratorVertexLitTexture
/*
** RB_StageIteratorVertexLitTexture
*/
void RB_StageIteratorVertexLitTexture( void )
{
shaderCommands_t *input;
shader_t *shader;
input = &tess;
shader = input->shader;
//
// compute colors
//
RB_CalcDiffuseColor( ( unsigned char * ) tess.svars.colors );
//
// 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_StageIteratorVertexLitTexturedUnfogged( %s ) ---\n", tess.shader->name) );
}
//
// set face culling appropriately
//
GL_Cull( shader->cullType );
//
// set arrays and lock
//
qglEnableClientState( GL_COLOR_ARRAY);
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors );
qglTexCoordPointer( 2, GL_FLOAT, 16, tess.texCoords[0][0] );
qglVertexPointer (3, GL_FLOAT, 16, input->xyz);
if ( qglLockArraysEXT )
{
qglLockArraysEXT(0, input->numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
//
// call special shade routine
//
R_BindAnimatedImage( &tess.xstages[0]->bundle[0] );
GL_State( tess.xstages[0]->stateBits );
R_DrawElements( input->numIndexes, input->indexes );
//
// 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();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
}
示例8: RB_StageIteratorGeneric
/*
** RB_StageIteratorGeneric
*/
void RB_StageIteratorGeneric( void )
{
shaderCommands_t *input;
shader_t *shader;
input = &tess;
shader = input->shader;
RB_DeformTessGeometry();
//
// 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_StageIteratorGeneric( %s ) ---\n", tess.shader->name) );
}
//
// set face culling appropriately
//
GL_Cull( shader->cullType );
// set polygon offset if necessary
if ( shader->polygonOffset )
{
qglEnable( GL_POLYGON_OFFSET_FILL );
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
}
//
// if there is only a single pass then we can enable color
// and texture arrays before we compile, otherwise we need
// to avoid compiling those arrays since they will change
// during multipass rendering
//
if ( tess.numPasses > 1 || shader->multitextureEnv )
{
setArraysOnce = qfalse;
qglDisableClientState (GL_COLOR_ARRAY);
qglDisableClientState (GL_TEXTURE_COORD_ARRAY);
}
else
{
setArraysOnce = qtrue;
qglEnableClientState( GL_COLOR_ARRAY);
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoords[0] );
}
//
// lock XYZ
//
qglVertexPointer (3, GL_FLOAT, 16, input->xyz); // padded for SIMD
if (qglLockArraysEXT)
{
qglLockArraysEXT(0, input->numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
//
// enable color and texcoord arrays after the lock if necessary
//
if ( !setArraysOnce )
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglEnableClientState( GL_COLOR_ARRAY );
}
//
// call shader function
//
RB_IterateStagesGeneric( input );
//
// now do any dynamic lighting needed
//
if ( tess.dlightBits && tess.shader->sort <= SS_OPAQUE
&& !(tess.shader->surfaceFlags & (SURF_NODLIGHT | SURF_SKY) ) ) {
ProjectDlightTexture();
}
//
// now do fog
//
if ( tess.fogNum && tess.shader->fogPass ) {
RB_FogPass();
}
//
// unlock arrays
//
//.........这里部分代码省略.........
示例9: DrawTris
/*
================
DrawTris
Draws triangle outlines for debugging
================
*/
static void DrawTris( shaderCommands_t *input ) {
char *s = r_trisColor->string;
vec4_t trisColor = { 1, 1, 1, 1 };
unsigned int stateBits = 0;
GL_Bind( tr.whiteImage );
if ( *s == '0' && ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) ) {
s += 2;
if ( Q_IsHexColorString( s ) ) {
trisColor[0] = ( (float)( gethex( *( s ) ) * 16 + gethex( *( s + 1 ) ) ) ) / 255.00;
trisColor[1] = ( (float)( gethex( *( s + 2 ) ) * 16 + gethex( *( s + 3 ) ) ) ) / 255.00;
trisColor[2] = ( (float)( gethex( *( s + 4 ) ) * 16 + gethex( *( s + 5 ) ) ) ) / 255.00;
if ( Q_HexColorStringHasAlpha( s ) ) {
trisColor[3] = ( (float)( gethex( *( s + 6 ) ) * 16 + gethex( *( s + 7 ) ) ) ) / 255.00;
}
}
} else {
int i;
char *token;
for ( i = 0 ; i < 4 ; i++ ) {
token = COM_Parse( &s );
if ( token ) {
trisColor[i] = atof( token );
} else {
trisColor[i] = 1.f;
}
}
if ( !trisColor[3] ) {
trisColor[3] = 1.f;
}
}
if ( trisColor[3] < 1.f ) {
stateBits |= ( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
}
qglColor4fv( trisColor );
// ydnar r_showtris 2
if ( r_showtris->integer == 2 ) {
stateBits |= ( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
GL_State( stateBits );
qglDepthRange( 0, 0 );
}
#ifdef CELSHADING_HACK
else if ( r_showtris->integer == 3 ) {
stateBits |= ( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
GL_State( stateBits );
qglEnable( GL_POLYGON_OFFSET_LINE );
qglPolygonOffset( 4.0, 0.5 );
qglLineWidth( 5.0 );
}
#endif
else
{
stateBits |= ( GLS_POLYMODE_LINE );
GL_State( stateBits );
qglEnable( GL_POLYGON_OFFSET_LINE );
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
}
qglDisableClientState( GL_COLOR_ARRAY );
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
qglVertexPointer( 3, GL_FLOAT, 16, input->xyz ); // padded for SIMD
if ( qglLockArraysEXT ) {
qglLockArraysEXT( 0, input->numVertexes );
GLimp_LogComment( "glLockArraysEXT\n" );
}
R_DrawElements( input->numIndexes, input->indexes );
if ( qglUnlockArraysEXT ) {
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
qglDepthRange( 0, 1 );
qglDisable( GL_POLYGON_OFFSET_LINE );
}
示例10: 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();
}
//.........这里部分代码省略.........
示例11: R_BindAnimatedImage
void CQuickSpriteSystem::Flush(void)
{
if (mNextVert==0)
{
return;
}
//
// render the main pass
//
R_BindAnimatedImage( mTexBundle );
GL_State(mGLStateBits);
//
// set arrays and lock
//
qglTexCoordPointer( 2, GL_FLOAT, 0, mTextureCoords );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
qglEnableClientState( GL_COLOR_ARRAY);
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, mColors );
qglVertexPointer (3, GL_FLOAT, 16, mVerts);
if ( qglLockArraysEXT )
{
qglLockArraysEXT(0, mNextVert);
GLimp_LogComment( "glLockArraysEXT\n" );
}
qglDrawArrays(GL_QUADS, 0, mNextVert);
backEnd.pc.c_vertexes += mNextVert;
backEnd.pc.c_indexes += mNextVert;
backEnd.pc.c_totalIndexes += mNextVert;
if (mUseFog)
{
//
// render the fog pass
//
GL_Bind( tr.fogImage );
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA | GLS_DEPTHFUNC_EQUAL );
//
// set arrays and lock
//
qglTexCoordPointer( 2, GL_FLOAT, 0, mFogTextureCoords);
// qglEnableClientState( GL_TEXTURE_COORD_ARRAY); // Done above
qglDisableClientState( GL_COLOR_ARRAY );
qglColor4ubv((GLubyte *)&mFogColor);
// qglVertexPointer (3, GL_FLOAT, 16, mVerts); // Done above
qglDrawArrays(GL_QUADS, 0, mNextVert);
// Second pass from fog
backEnd.pc.c_totalIndexes += mNextVert;
}
//
// unlock arrays
//
if (qglUnlockArraysEXT)
{
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
mNextVert=0;
}
示例12: GL_DrawAliasFrameLerp
//.........这里部分代码省略.........
GL_LerpVerts( paliashdr->num_xyz, v, ov, verts, lerp, move, frontv, backv );
if ( gl_vertex_arrays->value )
{
float colorArray[MAX_VERTS*4];
qglEnableClientState( GL_VERTEX_ARRAY );
qglVertexPointer( 3, GL_FLOAT, 16, s_lerped ); // padded for SIMD
// if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE ) )
// PMM - added double damage shell
if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM) )
{
qglColor4f( shadelight[0], shadelight[1], shadelight[2], alpha );
}
else
{
qglEnableClientState( GL_COLOR_ARRAY );
qglColorPointer( 3, GL_FLOAT, 0, colorArray );
//
// pre light everything
//
for ( i = 0; i < paliashdr->num_xyz; i++ )
{
float l = shadedots[verts[i].lightnormalindex];
colorArray[i*3+0] = l * shadelight[0];
colorArray[i*3+1] = l * shadelight[1];
colorArray[i*3+2] = l * shadelight[2];
}
}
if ( qglLockArraysEXT != 0 )
qglLockArraysEXT( 0, paliashdr->num_xyz );
while (1)
{
// get the vertex count and primitive type
count = *order++;
if (!count)
break; // done
if (count < 0)
{
count = -count;
qglBegin (GL_TRIANGLE_FAN);
}
else
{
qglBegin (GL_TRIANGLE_STRIP);
}
// PMM - added double damage shell
if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM) )
{
do
{
index_xyz = order[2];
order += 3;
qglVertex3fv( s_lerped[index_xyz] );
} while (--count);
}
else
{
示例13: RB_GLSL_StageIteratorGeneric
/*
* RB_GLSL_StageIteratorGeneric
* Stage iterator for GLSL programs
*/
void RB_GLSL_StageIteratorGeneric(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("--- R_GLSL_StageIteratorGeneric( %s ) ---\n", input->shader->name));
}
/* set face culling appropiately */
GL_Cull(input->shader->cullType);
/* set polygon offset if necessary */
if (input->shader->polygonOffset) {
qglEnable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(r_offsetFactor->value, r_offsetUnits->value);
}
/* set vertex color array */
qglEnableClientState(GL_COLOR_ARRAY);
qglColorPointer(4, GL_UNSIGNED_BYTE, 0, input->vertexColors);
/* set texture coordinate array 0 */
GL_SelectTexture(0);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, 16, input->texCoords[0][0]);
/* set texture coordinate array 1 */
GL_SelectTexture(1);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, 16, input->texCoords[0][1]);
/* set vertex normal array */
qglEnableClientState(GL_NORMAL_ARRAY);
qglNormalPointer(GL_FLOAT, 16, input->normal);
/* lock XYZ */
qglVertexPointer(3, GL_FLOAT, 16, input->xyz); /* padded SIMD */
if (qglLockArraysEXT) {
qglLockArraysEXT(0, input->numVertexes);
GLimp_LogComment("glLockArraysEXT\n");
}
RB_GLSL_IterateStagesGeneric(input);
/* now do any dynamic lighting needed */
if (input->dlightBits && input->shader->sort <= SS_OPAQUE && !(input->shader->surfaceFlags & (SURF_NODLIGHT | SURF_SKY)))
ProjectDlightTexture();
// <-- RiO_Outlines: now do outlines
RB_OutlinesPass();
// -->
/* now do fog */
if (input->fogNum && input->shader->fogPass)
RB_FogPass(); // TODO: uses svars which aren't set, so move to program
/* unlock arrays */
if (qglUnlockArraysEXT) {
qglUnlockArraysEXT();
GLimp_LogComment("glUnlockArraysExt\n");
}
/* reset polygon offset */
if (input->shader->polygonOffset)
qglDisable(GL_POLYGON_OFFSET_FILL);
}
示例14: R_DrawAliasFrameLerp
//.........这里部分代码省略.........
lerp = s_lerped [ 0 ];
R_LerpVerts( paliashdr->num_xyz, v, ov, verts, lerp, move, frontv, backv );
if ( gl_vertex_arrays->value )
{
float colorArray [ MAX_VERTS * 4 ];
qglEnableClientState( GL_VERTEX_ARRAY );
qglVertexPointer( 3, GL_FLOAT, 16, s_lerped );
if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM ) )
{
qglColor4f( shadelight [ 0 ], shadelight [ 1 ], shadelight [ 2 ], alpha );
}
else
{
qglEnableClientState( GL_COLOR_ARRAY );
qglColorPointer( 3, GL_FLOAT, 0, colorArray );
/* pre light everything */
for ( i = 0; i < paliashdr->num_xyz; i++ )
{
float l = shadedots [ verts [ i ].lightnormalindex ];
colorArray [ i * 3 + 0 ] = l * shadelight [ 0 ];
colorArray [ i * 3 + 1 ] = l * shadelight [ 1 ];
colorArray [ i * 3 + 2 ] = l * shadelight [ 2 ];
}
}
#if !defined(VERTEX_ARRAYS)
if ( qglLockArraysEXT != 0 )
{
qglLockArraysEXT( 0, paliashdr->num_xyz );
}
#endif
while ( 1 )
{
/* get the vertex count and primitive type */
count = *order++;
if ( !count )
{
break; /* done */
}
if ( count < 0 )
{
count = -count;
#if defined(VERTEX_ARRAYS)
type = GL_TRIANGLE_FAN;
#else
qglBegin( GL_TRIANGLE_FAN );
#endif
}
else
{
#if defined(VERTEX_ARRAYS)
type = GL_TRIANGLE_STRIP;
#else
qglBegin( GL_TRIANGLE_STRIP );
#endif
}
示例15: ProjectDlightTexture2
//.........这里部分代码省略.........
dStage = NULL;
if (tess.shader && qglActiveTextureARB)
{
int i = 0;
while (i < tess.shader->numUnfoggedPasses)
{
const int blendBits = (GLS_SRCBLEND_BITS+GLS_DSTBLEND_BITS);
if (((tess.shader->stages[i].bundle[0].image && !tess.shader->stages[i].bundle[0].isLightmap && !tess.shader->stages[i].bundle[0].numTexMods && tess.shader->stages[i].bundle[0].tcGen != TCGEN_ENVIRONMENT_MAPPED && tess.shader->stages[i].bundle[0].tcGen != TCGEN_FOG) ||
(tess.shader->stages[i].bundle[1].image && !tess.shader->stages[i].bundle[1].isLightmap && !tess.shader->stages[i].bundle[1].numTexMods && tess.shader->stages[i].bundle[1].tcGen != TCGEN_ENVIRONMENT_MAPPED && tess.shader->stages[i].bundle[1].tcGen != TCGEN_FOG)) &&
(tess.shader->stages[i].stateBits & blendBits) == 0 )
{ //only use non-lightmap opaque stages
dStage = &tess.shader->stages[i];
break;
}
i++;
}
}
if (!needResetVerts)
{
needResetVerts=1;
if (qglUnlockArraysEXT)
{
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
}
qglVertexPointer (3, GL_FLOAT, 16, vertCoordsArray); // padded for SIMD
if (dStage)
{
GL_SelectTexture( 0 );
GL_State(0);
qglTexCoordPointer( 2, GL_FLOAT, 0, oldTexCoordsArray[0] );
if (dStage->bundle[0].image && !dStage->bundle[0].isLightmap && !dStage->bundle[0].numTexMods && dStage->bundle[0].tcGen != TCGEN_ENVIRONMENT_MAPPED && dStage->bundle[0].tcGen != TCGEN_FOG)
{
R_BindAnimatedImage( &dStage->bundle[0] );
}
else
{
R_BindAnimatedImage( &dStage->bundle[1] );
}
GL_SelectTexture( 1 );
qglEnable( GL_TEXTURE_2D );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, texCoordsArray[0] );
qglEnableClientState( GL_COLOR_ARRAY );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
GL_Bind( tr.dlightImage );
GL_TexEnv( GL_MODULATE );
GL_State(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL);// | GLS_ATEST_GT_0);
R_DrawElements( numIndexes, hitIndexes );
qglDisable( GL_TEXTURE_2D );
GL_SelectTexture(0);
}
else
{
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, texCoordsArray[0] );
qglEnableClientState( GL_COLOR_ARRAY );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
GL_Bind( tr.dlightImage );
// include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
// where they aren't rendered
if ( dl->additive ) {
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
}
else {
GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
}
R_DrawElements( numIndexes, hitIndexes );
}
if (fogging)
{
qglEnable(GL_FOG);
}
backEnd.pc.c_totalIndexes += numIndexes;
backEnd.pc.c_dlightIndexes += numIndexes;
}
if (needResetVerts)
{
qglVertexPointer (3, GL_FLOAT, 16, tess.xyz); // padded for SIMD
if (qglLockArraysEXT)
{
qglLockArraysEXT(0, tess.numVertexes);
GLimp_LogComment( "glLockArraysEXT\n" );
}
}
}