PDGL_API void pdglFinish(void) { if(pglFinish) { pglFinish(); return; } pglFinish=pdglGetProcAddress("glFinish"); pglFinish(); }
/* =============== R_RenderFrame =============== */ void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld ) { if( r_norefresh->integer ) return; tr.realframecount++; if( RI.drawOrtho != gl_overview->integer ) tr.fResetVis = true; // completely override rendering if( clgame.drawFuncs.GL_RenderFrame != NULL ) { if( clgame.drawFuncs.GL_RenderFrame( fd, drawWorld )) { RI.drawWorld = drawWorld; tr.fResetVis = true; return; } } if( drawWorld ) r_lastRefdef = *fd; RI.params = RP_NONE; RI.farClip = 0; RI.clipFlags = 15; RI.drawWorld = drawWorld; RI.thirdPerson = cl.thirdperson; RI.drawOrtho = (RI.drawWorld) ? gl_overview->integer : 0; GL_BackendStartFrame(); if( !r_lockcull->integer ) VectorCopy( fd->vieworg, RI.cullorigin ); VectorCopy( fd->vieworg, RI.pvsorigin ); // setup viewport RI.viewport[0] = fd->viewport[0]; RI.viewport[1] = fd->viewport[1]; RI.viewport[2] = fd->viewport[2]; RI.viewport[3] = fd->viewport[3]; if( gl_finish->integer && drawWorld ) pglFinish(); if( gl_allow_mirrors->integer ) { // render mirrors R_FindMirrors( fd ); R_DrawMirrors (); } R_RenderScene( fd ); GL_BackendEndFrame(); }
// force finish of API rendering queue static void ogl_Finish(void) { ASSERT( _pGfx->gl_eCurrentAPI==GAT_OGL); _sfStats.StartTimer(CStatForm::STI_GFXAPI); pglFinish(); OGL_CHECKERROR; _sfStats.StopTimer(CStatForm::STI_GFXAPI); }
/* =============== R_ShowTextures Draw all the images to the screen, on top of whatever was there. This is used to test for texture thrashing. =============== */ void R_ShowTextures( void ) { gltexture_t *image; float x, y, w, h; int i, j, k, base_w, base_h; int total, start, end; rgba_t color = { 192, 192, 192, 255 }; int charHeight, numTries = 0; static qboolean showHelp = true; string shortname; if( !gl_showtextures->integer ) return; if( showHelp ) { CL_CenterPrint( "use '<-' and '->' keys to view all the textures", 0.25f ); showHelp = false; } pglClear( GL_COLOR_BUFFER_BIT ); pglFinish(); base_w = 8; base_h = 6; rebuild_page: total = base_w * base_h; start = total * (gl_showtextures->integer - 1); end = total * gl_showtextures->integer; if( end > MAX_TEXTURES ) end = MAX_TEXTURES; w = glState.width / (float)base_w; h = glState.height / (float)base_h; Con_DrawStringLen( NULL, NULL, &charHeight ); for( i = j = 0; i < MAX_TEXTURES; i++ ) { image = R_GetTexture( i ); if( j == start ) break; // found start if( pglIsTexture( image->texnum )) j++; } if( i == MAX_TEXTURES && gl_showtextures->integer != 1 ) { // bad case, rewind to one and try again Cvar_SetFloat( "r_showtextures", max( 1, gl_showtextures->integer - 1 )); if( ++numTries < 2 ) goto rebuild_page; // to prevent infinite loop } for( k = 0; i < MAX_TEXTURES; i++ ) { if( j == end ) break; // page is full image = R_GetTexture( i ); if( !pglIsTexture( image->texnum )) continue; x = k % base_w * w; y = k / base_w * h; pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GL_Bind( XASH_TEXTURE0, i ); // NOTE: don't use image->texnum here, because skybox has a 'wrong' indexes if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE )) pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE ); pglBegin( GL_QUADS ); pglTexCoord2f( 0, 0 ); pglVertex2f( x, y ); if( image->flags & TF_TEXTURE_RECTANGLE ) pglTexCoord2f( image->width, 0 ); else pglTexCoord2f( 1, 0 ); pglVertex2f( x + w, y ); if( image->flags & TF_TEXTURE_RECTANGLE ) pglTexCoord2f( image->width, image->height ); else pglTexCoord2f( 1, 1 ); pglVertex2f( x + w, y + h ); if( image->flags & TF_TEXTURE_RECTANGLE ) pglTexCoord2f( 0, image->height ); else pglTexCoord2f( 0, 1 ); pglVertex2f( x, y + h ); pglEnd(); if(( image->flags & TF_DEPTHMAP ) && !( image->flags & TF_NOCOMPARE )) pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); FS_FileBase( image->name, shortname ); if( Q_strlen( shortname ) > 18 ) { // cutoff too long names, it looks ugly shortname[16] = '.'; shortname[17] = '.'; shortname[18] = '\0'; } Con_DrawString( x + 1, y + h - charHeight, shortname, color ); j++, k++; } CL_DrawCenterPrint (); pglFinish(); }