void SCR_UpdateScreen (void) { VID_UpdateGamma(false); if (!scr_initialized) return; if (vid_hidden) return; // unbind everything to start the frame with a clean slate GL_UnbindBuffers (); GL_UnbindTextures (); SCR_CalcRefdef (); // Do 3D drawing first, followed by 2D, and then finally a finish command V_RenderView (); GL_Set2D (); if (r_netgraph.value) R_DrawNetGraph (); if (cl.intermission == 1 && key_dest != key_menu) { Sbar_IntermissionOverlay (); Con_ClearNotify (); } else if (cl.intermission == 2 && key_dest != key_menu) { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); Con_ClearNotify (); } if (cls.state == ca_active) { SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); if (!cl.intermission) { if (key_dest != key_menu) Draw_Crosshair (); SCR_CheckDrawCenterString (); SCR_DrawSpeed (); SCR_DrawFPS (); Sbar_Draw (); } } SCR_DrawConsole (); M_Draw (); Draw_EndBatching (); VID_Finish (); }
void VID_Finish (void) { qboolean vid_usevsync; // handle changes of the vsync option vid_usevsync = (vid_vsync.integer && !cls.timedemo); if (vid_usingvsync != vid_usevsync) { GLint sync = (vid_usevsync ? 1 : 0); if (qaglSetInteger(context, AGL_SWAP_INTERVAL, &sync) == GL_TRUE) { vid_usingvsync = vid_usevsync; Con_DPrintf("Vsync %s\n", vid_usevsync ? "activated" : "deactivated"); } else Con_Printf("ERROR: can't %s vsync\n", vid_usevsync ? "activate" : "deactivate"); } if (!vid_hidden) { if (r_speeds.integer == 2 || gl_finish.integer) GL_Finish(); qaglSwapBuffers(context); } VID_UpdateGamma(false, GAMMA_TABLE_SIZE); if (apple_multithreadedgl.integer) { if (!multithreadedgl) { if(qCGLGetCurrentContext && qCGLEnable && qCGLDisable) { CGLContextObj ctx = qCGLGetCurrentContext(); CGLError e = qCGLEnable(ctx, kCGLCEMPEngine); if(e == kCGLNoError) multithreadedgl = true; else { Con_Printf("WARNING: can't enable multithreaded GL, error %d\n", (int) e); Cvar_SetValueQuick(&apple_multithreadedgl, 0); } } else { Con_Printf("WARNING: can't enable multithreaded GL, CGL functions not present\n"); Cvar_SetValueQuick(&apple_multithreadedgl, 0); } } } else { if (multithreadedgl) { if(qCGLGetCurrentContext && qCGLEnable && qCGLDisable) { CGLContextObj ctx = qCGLGetCurrentContext(); qCGLDisable(ctx, kCGLCEMPEngine); multithreadedgl = false; } } } }