/* ================== V_RenderView The player's clipping box goes from (-16 -16 -24) to (16 16 32) from the entity origin, so any view position inside that will be valid ================== */ void V_RenderView(void) { if (con_forcedup) return; // don't allow cheats in multiplayer if (cl.maxclients > 1) { Cvar_Set("scr_ofsx", "0"); Cvar_Set("scr_ofsy", "0"); Cvar_Set("scr_ofsz", "0"); } if (cl.intermission) { // intermission / finale rendering V_CalcIntermissionRefdef(); } else { if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ ) V_CalcRefdef(); } R_PushDlights(); R_RenderView(); #ifndef GLQUAKE if (crosshair.value) Draw_Crosshair(); #endif }
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 (); }
/* ================== SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. WARNING: be very careful calling this from elsewhere, because the refresh needs almost the entire 256k of stack space! ================== */ void SCR_UpdateScreen (void) { if (block_drawing) return; scr_copytop = 0; scr_copyeverything = 0; if (scr_disabled_for_loading && !loading_num_step[0]) { if (realtime - scr_disabled_time > 60) { scr_disabled_for_loading = qfalse; Con_Printf ("load failed.\n"); } else return; } if (!scr_initialized || !con_initialized) return; // not initialized yet GL_BeginRendering (&glx, &gly, &glwidth, &glheight); // // determine size of refresh window // if (oldfov != scr_fov.value) { oldfov = scr_fov.value; vid.recalc_refdef = qtrue; } if (oldscreensize != scr_viewsize.value) { oldscreensize = scr_viewsize.value; vid.recalc_refdef = qtrue; } if (vid.recalc_refdef) SCR_CalcRefdef (); // // do 3D refresh drawing, and then update the screen // SCR_SetUpToDrawConsole (); V_RenderView (); GL_Set2D (); // // draw any areas not covered by the refresh // SCR_TileClear (); if (scr_drawdialog) { Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); scr_copyeverything = qtrue; } else if (scr_drawloading) { SCR_DrawLoading (); Sbar_Draw (); } else if (cl.intermission == 1 && key_dest == key_game) { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { //if (crosshair.value) // Draw_Character (scr_vrect.x + scr_vrect.width/2 - 4, scr_vrect.y + scr_vrect.height/2 - 4, '+'); Draw_Crosshair (); SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); //muff - to show FPS on screen SCR_DrawFPS (); SCR_DrawBAT (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole (); M_Draw (); } Draw_LoadingFill(); V_UpdatePalette (); GL_EndRendering (); }
/* SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. WARNING: be very careful calling this from elsewhere, because the refresh needs almost the entire 256k of stack space! */ void SCR_UpdateScreen (void) { static int oldscr_viewsize; vrect_t vrect; if (scr_skipupdate || block_drawing) return; if (scr_disabled_for_loading) return; #ifdef _WIN32 { // don't suck up any cpu if minimized extern qboolean Minimized; if (Minimized) return; } #endif scr_copytop = 0; scr_copyeverything = 0; if (!scr_initialized || !con_initialized) return; // not initialized yet if (scr_viewsize->int_val != oldscr_viewsize) { oldscr_viewsize = scr_viewsize->int_val; vid.recalc_refdef = 1; } // // check for vid changes // if (oldfov != scr_fov->int_val) { oldfov = scr_fov->int_val; vid.recalc_refdef = true; } if (oldscreensize != scr_viewsize->int_val) { oldscreensize = scr_viewsize->int_val; vid.recalc_refdef = true; } if (oldsbar != cl_sbar->int_val) { oldsbar = cl_sbar->int_val; vid.recalc_refdef = true; } if (vid.recalc_refdef) { // something changed, so reorder the screen SCR_CalcRefdef (); } // // do 3D refresh drawing, and then update the screen // D_EnableBackBufferAccess (); // of all overlay stuff if drawing // directly if (scr_fullupdate++ < vid.numpages) { // clear the entire screen scr_copyeverything = 1; Draw_TileClear (0, 0, vid.width, vid.height); Sbar_Changed (); } pconupdate = NULL; SCR_SetUpToDrawConsole (); D_DisableBackBufferAccess (); // for adapters that can't stay // mapped in // for linear writes all the time VID_LockBuffer (); V_RenderView (); VID_UnlockBuffer (); D_EnableBackBufferAccess (); // of all overlay stuff if drawing // directly if (cl.intermission == 1 && key_dest == key_game) { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { if (crosshair->int_val) Draw_Crosshair (); SCR_DrawRam (); SCR_DrawNet (); SCR_DrawFPS (); SCR_DrawTime (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole (); M_Draw (); } D_DisableBackBufferAccess (); // for adapters that can't stay // mapped in // for linear writes all the time if (pconupdate) { D_UpdateRects (pconupdate); } V_UpdatePalette (); // // update one of three areas // if (scr_copyeverything) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height; vrect.pnext = 0; VID_Update (&vrect); } else if (scr_copytop) { vrect.x = 0; vrect.y = 0; vrect.width = vid.width; vrect.height = vid.height - sb_lines; vrect.pnext = 0; VID_Update (&vrect); } else { vrect.x = scr_vrect.x; vrect.y = scr_vrect.y; vrect.width = scr_vrect.width; vrect.height = scr_vrect.height; vrect.pnext = 0; VID_Update (&vrect); } }
/* ================== SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. WARNING: be very careful calling this from elsewhere, because the refresh needs almost the entire 256k of stack space! ================== */ void SCR_UpdateScreen (void) { if (cls.state == ca_dedicated) return; // stdout only if (vid_hiddenwindow || block_drawing) return; // don't suck up any cpu if minimized or blocked for drawing if (!scr_initialized || !con_initialized) return; // not initialized yet vid.numpages = 2 + (gl_triplebuffer.value ? 1 : 0); // in case gl_triplebuffer is not 0 or 1 if (scr_disabled_for_loading) { if (realtime - scr_disabled_time > scr_timeout) { scr_disabled_for_loading = false; if (scr_timeout == SCR_DEFTIMEOUT) Con_Printf ("screen update timeout -- load failed.\n"); } else return; } // // check for vid changes // if (oldscreensize != scr_viewsize.value) { oldscreensize = scr_viewsize.value; vid.recalc_refdef = true; } if (oldweaponsize != scr_weaponsize.value) { oldweaponsize = scr_weaponsize.value; vid.recalc_refdef = true; } if (oldfov != scr_fov.value) { oldfov = scr_fov.value; vid.recalc_refdef = true; } if (oldweaponfov != scr_weaponfov.value) { oldweaponfov = scr_weaponfov.value; vid.recalc_refdef = true; } if (oldsbar != scr_sbar.value) { oldsbar = scr_sbar.value; vid.recalc_refdef = true; } if (oldoverdrawsbar != scr_overdrawsbar.value) { oldoverdrawsbar = scr_overdrawsbar.value; vid.recalc_refdef = true; } if (vid.recalc_refdef) { // something changed, so reorder the screen SCR_CalcRefdef (); } if (scr_overdrawsbar.value || gl_clear.value || isIntel) // intel video workaround Sbar_Changed (); // // do 3D refresh drawing, and then update the screen // GL_BeginRendering (&glx, &gly, &glwidth, &glheight); SCR_SetUpToDrawConsole (); V_RenderView (); GL_Set2D (); // // draw any areas not covered by the refresh // if (scr_sbar.value || scr_viewsize.value < 100) { SCR_TileClear (); Sbar_Changed (); } if (scr_drawdialog) //new game confirm { Sbar_Draw (); Draw_FadeScreen (); SCR_DrawNotifyString (); } else if (scr_drawloading) //loading { SCR_DrawLoading (); Sbar_Draw (); } else if (cl.intermission == 1 && key_dest == key_game) //end of level { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) //end of episode { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { Draw_Crosshair (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); SCR_DrawFPS (); SCR_DrawStats (); Sbar_Draw (); SCR_DrawConsole (); M_Draw (); } V_UpdateBlend (); GL_EndRendering (); }
/* SCR_UpdateScreen This is called every frame, and can also be called explicitly to flush text to the screen. WARNING: be very careful calling this from elsewhere, because the refresh needs almost the entire 256k of stack space! */ void SCR_UpdateScreen (void) { double time1 = 0, time2; float f; if (block_drawing) return; vid.numpages = 2 + gl_triplebuffer->int_val; scr_copytop = 0; scr_copyeverything = 0; if (scr_disabled_for_loading) { if (realtime - scr_disabled_time > 60) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else { return; } } if (!scr_initialized || !con_initialized) // not initialized yet return; if (oldsbar != cl_sbar->int_val) { oldsbar = cl_sbar->int_val; vid.recalc_refdef = true; } if (oldviewsize != scr_viewsize->int_val) { oldviewsize = scr_viewsize->int_val; vid.recalc_refdef = true; } GL_BeginRendering (&glx, &gly, &glwidth, &glheight); if (r_speeds->int_val) { time1 = Sys_DoubleTime (); c_brush_polys = 0; c_alias_polys = 0; } if (oldfov != scr_fov->value) { // determine size of refresh window oldfov = scr_fov->value; vid.recalc_refdef = true; } if (vid.recalc_refdef) SCR_CalcRefdef (); // do 3D refresh drawing, and then update the screen if (lighthalf != gl_lightmode->int_val) { lighthalf = gl_lightmode->int_val; if (lighthalf) lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128; else lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255; R_ForceLightUpdate (); } SCR_SetUpToDrawConsole (); V_RenderView (); GL_Set2D (); // draw any areas not covered by the refresh SCR_TileClear (); if (r_netgraph->int_val) R_NetGraph (); if (cl.intermission == 1 && key_dest == key_game) { Sbar_IntermissionOverlay (); } else if (cl.intermission == 2 && key_dest == key_game) { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } else { if (crosshair->int_val) Draw_Crosshair (); SCR_DrawRam (); SCR_DrawNet (); SCR_DrawFPS (); SCR_DrawTime (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole (); M_Draw (); } // LordHavoc: adjustable brightness and contrast, // also makes polyblend apply to whole screen glDisable (GL_TEXTURE_2D); Cvar_SetValue (brightness, bound (1, brightness->value, 5)); if (lighthalf) // LordHavoc: render was done at half // // brightness f = brightness->value * 2; else f = brightness->value; if (f >= 1.002) { // Make sure we don't get bit by // roundoff errors glBlendFunc (GL_DST_COLOR, GL_ONE); glBegin (GL_QUADS); while (f >= 1.002) { // precision if (f >= 2) glColor3f (1, 1, 1); else glColor3f (f - 1, f - 1, f - 1); glVertex2f (0, 0); glVertex2f (vid.width, 0); glVertex2f (vid.width, vid.height); glVertex2f (0, vid.height); f *= 0.5; } glEnd (); glColor3ubv (lighthalf_v); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } if (v_blend[3]) { glBegin (GL_QUADS); glColor4fv (v_blend); glVertex2f (0, 0); glVertex2f (vid.width, 0); glVertex2f (vid.width, vid.height); glVertex2f (0, vid.height); glEnd (); glColor3ubv (lighthalf_v); } glEnable (GL_TEXTURE_2D); V_UpdatePalette (); if (r_speeds->int_val) { // glFinish (); time2 = Sys_DoubleTime (); Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int) ((time2 - time1) * 1000), c_brush_polys, c_alias_polys); } glFinish (); GL_EndRendering (); }