/* Grab six views for environment mapping tests */ void R_Envmap_f(void) { uint8_t buffer[256*256*4]; glDrawBuffer(GL_FRONT); glReadBuffer(GL_FRONT); r_refdef.bEnvironmentMap = true; r_refdef.vrect.x = r_refdef.vrect.y = 0; r_refdef.vrect.width = r_refdef.vrect.height = 256; Math_VectorClear(r_refdef.viewangles); GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile ("env0.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 90; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile ("env1.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 180; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile ("env2.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 270; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile ("env3.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[0] = -90.0f; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile("env4.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[0] = 90; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); FileSystem_WriteFile("env5.rgb",buffer,sizeof(buffer)); r_refdef.bEnvironmentMap = false; glDrawBuffer(GL_BACK); glReadBuffer(GL_BACK); GL_EndRendering(); }
void SCR_UpdateScreen (void) { vid.numpages = (gl_triplebuffer.value) ? 3 : 2; 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) return; // not initialized yet GL_BeginRendering (&glx, &gly, &glwidth, &glheight); // // determine size of refresh window // if (vid.recalc_refdef) SCR_CalcRefdef (); SCR_SetUpToDrawConsole (); if (vr_enabled.value && !con_forcedup) { VR_UpdateScreenContent(); // phoboslab } else { VectorCopy (cl.aimangles, cl.viewangles); VectorCopy (cl.aimangles, r_refdef.viewangles); VectorCopy (cl.aimangles, r_refdef.aimangles); SCR_UpdateScreenContent(); } 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) { vid.numpages = (gl_triplebuffer.value) ? 3 : 2; 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) return; // not initialized yet GL_BeginRendering (&glx, &gly, &glwidth, &glheight); // // determine size of refresh window // if (vid.recalc_refdef) SCR_CalcRefdef (); // // do 3D refresh drawing, and then update the screen // SCR_SetUpToDrawConsole (); V_RenderView (); GL_Set2D (); //FIXME: only call this when needed SCR_TileClear (); if (scr_drawdialog) //new game confirm { if (con_forcedup) Draw_ConsoleBackground (); else 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 { SCR_DrawCrosshair (); //johnfitz SCR_DrawRam (); SCR_DrawNet (); SCR_DrawTurtle (); SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawDevStats (); //johnfitz SCR_DrawFPS (); //johnfitz SCR_DrawClock (); //johnfitz SCR_DrawConsole (); M_Draw (); } V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed GLSLGamma_GammaCorrect (); GL_EndRendering (); }
/* 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(scr_disabled_for_loading) { if(realtime-scr_disabled_time > 60.0f) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else return; } if(!bScreenInitialized || !bConsoleInitialized) return; // not initialized yet GL_BeginRendering(&glx,&gly,&glwidth,&glheight); Video.iFrameCount++; // Don't let us exceed a limited count. if (Video.iFrameCount > 100000) Video.iFrameCount = 0; // determine size of refresh window if(oldfov != scr_fov.value) { oldfov = scr_fov.value; vid.bRecalcRefDef = true; } if (oldscreensize != scr_viewsize.value) { oldscreensize = scr_viewsize.value; vid.bRecalcRefDef = true; } //johnfitz -- added oldsbarscale and oldsbaralpha if (oldsbarscale != scr_sbarscale.value) { oldsbarscale = scr_sbarscale.value; vid.bRecalcRefDef = true; } if (oldsbaralpha != scr_sbaralpha.value) { oldsbaralpha = scr_sbaralpha.value; vid.bRecalcRefDef = true; } //johnfitz if (vid.bRecalcRefDef) Screen_UpdateSize(); // do 3D refresh drawing, and then update the screen Screen_SetUpToDrawConsole(); if (cv_video_msaasamples.iValue > 0) VideoLayer_Enable(VIDEO_MULTISAMPLE); V_RenderView (); if (cv_video_msaasamples.iValue > 0) VideoLayer_Disable(VIDEO_MULTISAMPLE); Draw_ResetCanvas(); //FIXME: only call this when needed SCR_TileClear(); if(bDrawDialog) //new game confirm { g_menu->Draw(); Draw_FadeScreen(); SCR_DrawNotifyString(); } else if (g_menu->GetState() & MENU_STATE_LOADING) //loading g_menu->Draw(); else if(cl.intermission == 1 && key_dest == key_game) //end of level {} else if(cl.intermission == 2 && key_dest == key_game) //end of episode SCR_CheckDrawCenterString (); else { g_menu->Draw(); #ifdef VIDEO_SUPPORT_SHADERS #ifdef VIDEO_SUPPORT_FRAMEBUFFERS //VideoPostProcess_Draw(); DEBUG_FrameBufferDraw(); #endif #endif SCR_DrawNet(); SCR_DrawTurtle(); SCR_DrawPause(); SCR_CheckDrawCenterString (); SCR_DrawDevStats(); //johnfitz SCR_DrawClock(); //johnfitz Screen_DrawConsole(); Screen_DrawFPS(); //johnfitz } V_UpdateBlend(); //johnfitz -- V_UpdatePalette cleaned up and renamed }
/* ================== 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) { 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 (); }
/* 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(scr_disabled_for_loading) { if(realtime-scr_disabled_time > 60.0f) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else return; } if(!bScreenInitialized || !bConsoleInitialized) 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.bRecalcRefDef = true; } if (oldscreensize != scr_viewsize.value) { oldscreensize = scr_viewsize.value; vid.bRecalcRefDef = true; } //johnfitz -- added oldsbarscale and oldsbaralpha if (oldsbarscale != scr_sbarscale.value) { oldsbarscale = scr_sbarscale.value; vid.bRecalcRefDef = true; } if (oldsbaralpha != scr_sbaralpha.value) { oldsbaralpha = scr_sbaralpha.value; vid.bRecalcRefDef = true; } //johnfitz if (vid.bRecalcRefDef) SCR_CalcRefdef (); // do 3D refresh drawing, and then update the screen SCR_SetUpToDrawConsole (); V_RenderView (); Draw_ResetCanvas(); //FIXME: only call this when needed SCR_TileClear(); if(bDrawDialog) //new game confirm { Menu->Draw(); Draw_FadeScreen(); SCR_DrawNotifyString(); } else if(Menu->GetState() & MENU_STATE_LOADING) //loading Menu->Draw(); else if(cl.intermission == 1 && key_dest == key_game) //end of level {} else if(cl.intermission == 2 && key_dest == key_game) //end of episode SCR_CheckDrawCenterString (); else { Menu->Draw(); SCR_DrawNet(); SCR_DrawTurtle(); SCR_DrawPause(); SCR_CheckDrawCenterString (); SCR_DrawDevStats(); //johnfitz Screen_DrawFPS(); //johnfitz SCR_DrawClock(); //johnfitz SCR_DrawConsole(); } V_UpdateBlend(); //johnfitz -- V_UpdatePalette cleaned up and renamed }
/* 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 (); }