cvar_t scr_viewsize = {CVAR_SAVE, "viewsize","100", "how large the view should be, 110 disables inventory bar, 120 disables status bar"};
cvar_t scr_fov = {CVAR_SAVE, "fov","90", "field of vision, 1-170 degrees, default 90, some players use 110-130"};
cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1", "opacity of console background gfx/conback"};
-cvar_t scr_conalpha2factor = {CVAR_SAVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to gfx/conback; when 0, gfx/conback2 is not drawn"};
+cvar_t scr_conalphafactor = {CVAR_SAVE, "scr_conalphafactor", "1", "opacity of console background gfx/conback relative to scr_conalpha; when 0, gfx/conback is not drawn"};
+cvar_t scr_conalpha2factor = {CVAR_SAVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to scr_conalpha; when 0, gfx/conback2 is not drawn"};
+cvar_t scr_conalpha3factor = {CVAR_SAVE, "scr_conalpha3factor", "0", "opacity of console background gfx/conback3 relative to scr_conalpha; when 0, gfx/conback3 is not drawn"};
cvar_t scr_conbrightness = {CVAR_SAVE, "scr_conbrightness", "1", "brightness of console background (0 = black, 1 = image)"};
cvar_t scr_conforcewhiledisconnected = {0, "scr_conforcewhiledisconnected", "1", "forces fullscreen console while disconnected"};
cvar_t scr_conscroll_x = {CVAR_SAVE, "scr_conscroll_x", "0", "scroll speed of gfx/conback in x direction"};
cvar_t scr_conscroll_y = {CVAR_SAVE, "scr_conscroll_y", "0", "scroll speed of gfx/conback in y direction"};
cvar_t scr_conscroll2_x = {CVAR_SAVE, "scr_conscroll2_x", "0", "scroll speed of gfx/conback2 in x direction"};
cvar_t scr_conscroll2_y = {CVAR_SAVE, "scr_conscroll2_y", "0", "scroll speed of gfx/conback2 in y direction"};
+cvar_t scr_conscroll3_x = {CVAR_SAVE, "scr_conscroll3_x", "0", "scroll speed of gfx/conback3 in x direction"};
+cvar_t scr_conscroll3_y = {CVAR_SAVE, "scr_conscroll3_y", "0", "scroll speed of gfx/conback3 in y direction"};
cvar_t scr_menuforcewhiledisconnected = {0, "scr_menuforcewhiledisconnected", "0", "forces menu while disconnected"};
cvar_t scr_centertime = {0, "scr_centertime","2", "how long centerprint messages show"};
cvar_t scr_showram = {CVAR_SAVE, "showram","1", "show ram icon if low on surface cache memory (not used)"};
double r_timereport_temp = 0, r_timereport_current = 0, r_timereport_start = 0;
int r_speeds_longestitem = 0;
-void R_TimeReport(char *desc)
+void R_TimeReport(const char *desc)
{
char tempbuf[256];
int length;
return;
CHECKGLERROR
- if (r_speeds.integer == 2)
+ if (r_speeds.integer == 2 && qglFinish)
qglFinish();
CHECKGLERROR
r_timereport_temp = r_timereport_current;
lines++;
y = vid_conheight.integer - sb_lines - lines * 8;
i = j = 0;
+ r_draw2d_force = true;
DrawQ_Fill(0, y, vid_conwidth.integer, lines * 8, 0, 0, 0, 0.5, 0);
while (string[i])
{
i++;
y += 8;
}
+ r_draw2d_force = false;
}
}
Cvar_RegisterVariable (&scr_fov);
Cvar_RegisterVariable (&scr_viewsize);
Cvar_RegisterVariable (&scr_conalpha);
+ Cvar_RegisterVariable (&scr_conalphafactor);
Cvar_RegisterVariable (&scr_conalpha2factor);
+ Cvar_RegisterVariable (&scr_conalpha3factor);
Cvar_RegisterVariable (&scr_conscroll_x);
Cvar_RegisterVariable (&scr_conscroll_y);
Cvar_RegisterVariable (&scr_conscroll2_x);
Cvar_RegisterVariable (&scr_conscroll2_y);
+ Cvar_RegisterVariable (&scr_conscroll3_x);
+ Cvar_RegisterVariable (&scr_conscroll3_y);
Cvar_RegisterVariable (&scr_conbrightness);
Cvar_RegisterVariable (&scr_conforcewhiledisconnected);
Cvar_RegisterVariable (&scr_menuforcewhiledisconnected);
buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 4);
buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * (scr_screenshot_alpha.integer ? 4 : 3));
- if (SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, jpeg, png, true, scr_screenshot_alpha.integer))
+ if (SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, jpeg, png, true, scr_screenshot_alpha.integer != 0))
Con_Printf("Wrote %s\n", filename);
else
{
Con_Printf("Unable to write %s\n", filename);
if(jpeg || png)
{
- if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer))
+ if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer != 0))
{
strlcpy(filename + strlen(filename) - 3, "tga", 4);
Con_Printf("Wrote %s\n", filename);
CHECKGLERROR
// speed is critical here, so do saving as directly as possible
- qglReadPixels (x, y, vid.width, vid.height, GL_BGRA, GL_UNSIGNED_BYTE, cls.capturevideo.screenbuffer);CHECKGLERROR
+ GL_ReadPixelsBGRA(x, y, vid.width, vid.height, cls.capturevideo.screenbuffer);
+
SCR_ScaleDownBGRA (cls.capturevideo.screenbuffer, vid.width, vid.height, cls.capturevideo.outbuffer, width, height);
cls.capturevideo.videoframes(newframestepframenum - cls.capturevideo.framestepframe);
struct envmapinfo_s
{
float angles[3];
- char *name;
+ const char *name;
qboolean flipx, flipy, flipdiagonaly;
}
envmapinfo[12] =
int i;
for (i = 0;i < cl.num_showlmps;i++)
if (cl.showlmps[i].isactive)
- DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic (cl.showlmps[i].pic), 0, 0, 1, 1, 1, 1, 0);
+ DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic_Flags (cl.showlmps[i].pic, CACHEPICFLAG_NOTPERSISTENT), 0, 0, 1, 1, 1, 1, 0);
}
/*
int indices[4] = {0,1,2,3}; // BGRA
qboolean ret;
- CHECKGLERROR
- qglReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, buffer1);CHECKGLERROR
+ GL_ReadPixelsBGRA(x, y, width, height, buffer1);
if(gammacorrect && (scr_screenshot_gammaboost.value != 1 || WANT_SCREENSHOT_HWGAMMA))
{
extern void R_UpdateFogColor(void);
void R_ClearScreen(qboolean fogcolor)
{
+ float clearcolor[4];
// clear to black
- CHECKGLERROR
+ Vector4Clear(clearcolor);
if (fogcolor)
{
R_UpdateFogColor();
- qglClearColor(r_refdef.fogcolor[0],r_refdef.fogcolor[1],r_refdef.fogcolor[2],0);CHECKGLERROR
- }
- else
- {
- qglClearColor(0,0,0,0);CHECKGLERROR
- }
- qglClearDepth(1);CHECKGLERROR
- if (vid.stencil)
- {
- // LordHavoc: we use a stencil centered around 128 instead of 0,
- // to avoid clamping interfering with strange shadow volume
- // drawing orders
- qglClearStencil(128);CHECKGLERROR
+ VectorCopy(r_refdef.fogcolor, clearcolor);
}
+ // clear depth is 1.0
+ // LordHavoc: we use a stencil centered around 128 instead of 0,
+ // to avoid clamping interfering with strange shadow volume
+ // drawing orders
// clear the screen
- GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0));
- // set dithering mode
- if (gl_dither.integer)
- {
- qglEnable(GL_DITHER);CHECKGLERROR
- }
- else
- {
- qglDisable(GL_DITHER);CHECKGLERROR
- }
+ GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0), clearcolor, 1.0f, 128);
}
qboolean CL_VM_UpdateView (void);
loadingscreentexture_h = vid.height / (float) h;
}
- loadingscreentexture = R_LoadTexture2D(r_main_texturepool, "loadingscreentexture", w, h, NULL, TEXTYPE_COLORBUFFER, TEXF_FORCENEAREST | TEXF_CLAMP, -1, NULL);
+ loadingscreentexture = R_LoadTexture2D(r_main_texturepool, "loadingscreentexture", w, h, NULL, TEXTYPE_COLORBUFFER, TEXF_RENDERTARGET | TEXF_FORCENEAREST | TEXF_CLAMP, -1, NULL);
R_Mesh_CopyToTexture(loadingscreentexture, 0, 0, 0, 0, vid.width, vid.height);
loadingscreentexture_vertex3f[2] = loadingscreentexture_vertex3f[5] = loadingscreentexture_vertex3f[8] = loadingscreentexture_vertex3f[11] = 0;
// release mouse grab while loading
if (!vid.fullscreen)
VID_SetMouse(false, false, false);
- CHECKGLERROR
+// CHECKGLERROR
+ r_refdef.draw2dstage = true;
R_Viewport_InitOrtho(&viewport, &identitymatrix, 0, 0, vid.width, vid.height, 0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100, NULL);
R_SetViewport(&viewport);
- //qglDisable(GL_SCISSOR_TEST);CHECKGLERROR
- //qglDepthMask(1);CHECKGLERROR
- qglColorMask(1,1,1,1);CHECKGLERROR
- qglClearColor(0,0,0,0);CHECKGLERROR
+ GL_ColorMask(1,1,1,1);
// when starting up a new video mode, make sure the screen is cleared to black
if (clear)
- qglClear(GL_COLOR_BUFFER_BIT);CHECKGLERROR
+ GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 0);
R_Textures_Frame();
R_Mesh_Start();
R_EntityMatrix(&identitymatrix);
R_Mesh_Finish();
// refresh
VID_Finish();
- // however this IS necessary on Windows Vista
- qglFinish();
}
void SCR_UpdateLoadingScreen (qboolean clear)
}
else
{
- qglDrawBuffer(GL_BACK);
+ if (qglDrawBuffer)
+ qglDrawBuffer(GL_BACK);
SCR_DrawLoadingScreen(clear);
}
SCR_DrawLoadingScreen_SharedFinish(clear);
double rendertime1;
float conwidth, conheight;
float f;
+ r_viewport_t viewport;
Sbar_ShowFPS_Update();
}
if (vid_hidden)
+ {
+ VID_Finish();
return;
+ }
rendertime1 = Sys_DoubleTime();
SCR_SetUpToDrawConsole();
- CHECKGLERROR
- qglDrawBuffer(GL_BACK);CHECKGLERROR
- qglViewport(0, 0, vid.width, vid.height);CHECKGLERROR
- qglDisable(GL_SCISSOR_TEST);CHECKGLERROR
- qglDepthMask(1);CHECKGLERROR
- qglColorMask(1,1,1,1);CHECKGLERROR
- qglClearColor(0,0,0,0);CHECKGLERROR
+ if (qglDrawBuffer)
+ {
+ CHECKGLERROR
+ qglDrawBuffer(GL_BACK);CHECKGLERROR
+ // set dithering mode
+ if (gl_dither.integer)
+ {
+ qglEnable(GL_DITHER);CHECKGLERROR
+ }
+ else
+ {
+ qglDisable(GL_DITHER);CHECKGLERROR
+ }
+ }
+
+ R_Viewport_InitOrtho(&viewport, &identitymatrix, 0, 0, vid.width, vid.height, 0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100, NULL);
+ R_SetViewport(&viewport);
+ GL_ScissorTest(false);
+ GL_ColorMask(1,1,1,1);
+ GL_DepthMask(true);
+
R_ClearScreen(false);
r_refdef.view.clear = false;
r_refdef.view.isoverlay = false;
}
}
- CHECKGLERROR
if (R_Stereo_Active())
{
matrix4x4_t originalmatrix = r_refdef.view.matrix;
}
else
SCR_DrawScreen();
- CHECKGLERROR
SCR_CaptureVideo();
+ if (qglFlush)
+ qglFlush(); // FIXME: should we really be using qglFlush here?
+
// quality adjustment according to render time
- CHECKGLERROR
- qglFlush(); // FIXME: should we really be using qglFlush here?
cl_updatescreen_rendertime += ((Sys_DoubleTime() - rendertime1) - cl_updatescreen_rendertime) * bound(0, cl_minfps_fade.value, 1);
if (cl_minfps.value > 0 && cl_updatescreen_rendertime > 0 && !cls.timedemo && (!cls.capturevideo.active || !cls.capturevideo.realtime))
cl_updatescreen_quality = 1 / (cl_updatescreen_rendertime * cl_minfps.value);
else if (key_dest == key_menu)
VID_SetMouse(vid.fullscreen, vid_mouse.integer && !in_client_mouse, true);
else
- VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cl.csqc_wantsmousemove && (!cls.demoplayback || cl_demo_mousegrab.integer), true);
+ VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cl.csqc_wantsmousemove && cl_prydoncursor.integer <= 0 && (!cls.demoplayback || cl_demo_mousegrab.integer), true);
VID_Finish();
}