qglClearColor(0,0,0,0);CHECKGLERROR
}
qglClearDepth(1);CHECKGLERROR
- if (gl_stencil)
+ if (vid.stencil)
{
// LordHavoc: we use a stencil centered around 128 instead of 0,
// to avoid clamping interfering with strange shadow volume
qglClearStencil(128);CHECKGLERROR
}
// clear the screen
- GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (gl_stencil ? GL_STENCIL_BUFFER_BIT : 0));
+ GL_Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | (vid.stencil ? GL_STENCIL_BUFFER_BIT : 0));
// set dithering mode
if (gl_dither.integer)
{
if (!r_refdef.view.useperspective)
R_Viewport_InitOrtho(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, -r_refdef.view.ortho_x, -r_refdef.view.ortho_y, r_refdef.view.ortho_x, r_refdef.view.ortho_y, -r_refdef.farclip, r_refdef.farclip, customclipplane);
- else if (gl_stencil && r_useinfinitefarclip.integer)
+ else if (vid.stencil && r_useinfinitefarclip.integer)
R_Viewport_InitPerspectiveInfinite(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, r_refdef.view.frustum_x, r_refdef.view.frustum_y, r_refdef.nearclip, customclipplane);
else
R_Viewport_InitPerspective(&r_refdef.view.viewport, &r_refdef.view.matrix, r_refdef.view.x, vid.height - r_refdef.view.height - r_refdef.view.y, r_refdef.view.width, r_refdef.view.height, r_refdef.view.frustum_x, r_refdef.view.frustum_y, r_refdef.nearclip, r_refdef.farclip, customclipplane);
r_refdef.shadowpolygonoffset = r_refdef.polygonoffset + r_shadow_polygonoffset.value * (r_shadow_frontsidecasting.integer ? 1 : -1);
r_refdef.scene.rtworld = r_shadow_realtime_world.integer != 0;
- r_refdef.scene.rtworldshadows = r_shadow_realtime_world_shadows.integer && gl_stencil;
+ r_refdef.scene.rtworldshadows = r_shadow_realtime_world_shadows.integer && vid.stencil;
r_refdef.scene.rtdlight = (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && !gl_flashblend.integer && r_dynamic.integer;
- r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && gl_stencil;
+ r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && vid.stencil;
r_refdef.lightmapintensity = r_refdef.scene.rtworld ? r_shadow_realtime_world_lightmaps.value : 1;
if (r_showsurfaces.integer)
{
// Current and Proposed Resolution
M_Print(16, video_cursor_table[t] - 12, " Current Resolution");
if (vid_supportrefreshrate && vid.userefreshrate && vid.fullscreen)
- M_Print(220, video_cursor_table[t] - 12, va("%dx%d %dhz", vid.width, vid.height, vid.refreshrate));
+ M_Print(220, video_cursor_table[t] - 12, va("%dx%d %.2fhz", vid.width, vid.height, vid.refreshrate));
else
M_Print(220, video_cursor_table[t] - 12, va("%dx%d", vid.width, vid.height));
M_Print(16, video_cursor_table[t], " New Resolution");
// Refresh Rate
M_ItemPrint(16, video_cursor_table[t], " Refresh Rate", vid_supportrefreshrate && vid_userefreshrate.integer);
- M_DrawSlider(220, video_cursor_table[t], vid_refreshrate.integer, 60, 150);
+ M_DrawSlider(220, video_cursor_table[t], vid_refreshrate.value, 50, 150);
t++;
// Fullscreen
else if (video_cursor == t++)
Cvar_SetValueQuick (&vid_userefreshrate, !vid_userefreshrate.integer);
else if (video_cursor == t++)
- Cvar_SetValueQuick (&vid_refreshrate, bound(60, vid_refreshrate.integer + dir, 150));
+ Cvar_SetValueQuick (&vid_refreshrate, bound(50, vid_refreshrate.value + dir, 150));
else if (video_cursor == t++)
Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer);
else if (video_cursor == t++)
if (r_glsl.integer && gl_support_fragment_shader)
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_GLSL;
- else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && gl_stencil)
+ else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && vid.stencil)
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_DOT3;
else
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX;
for (i = 0;i < numlightentities;i++)
R_Shadow_DrawEntityLight(lightentities[i]);
}
- else if (castshadows && gl_stencil)
+ else if (castshadows && vid.stencil)
{
// draw stencil shadow volumes to mask off pixels that are in shadow
// so that they won't receive lighting
vec3_t relativeshadowmins, relativeshadowmaxs;
vec3_t tmp, shadowdir;
- if (!r_drawentities.integer || !gl_stencil)
+ if (!r_drawentities.integer || !vid.stencil)
return;
CHECKGLERROR
{
// these are set by VID_Mode
viddef_mode_t mode;
+ // used in many locations in the renderer
int width;
int height;
int bitsperpixel;
qboolean fullscreen;
- int refreshrate;
+ float refreshrate;
qboolean userefreshrate;
qboolean stereobuffer;
int samples;
+ qboolean stencil;
} viddef_t;
// global video state
extern cvar_t v_color_white_b;
extern cvar_t v_hwgamma;
-extern int gl_stencil;
-
// brand of graphics chip
extern const char *gl_vendor;
// graphics chip model and other information
int gl_supportslockarrays = false;
// GLX_SGI_swap_control or WGL_EXT_swap_control
int gl_videosyncavailable = false;
-// stencil available
-int gl_stencil = false;
// 3D textures available
int gl_texture3d = false;
// GL_ARB_texture_cubemap
vid.userefreshrate = vid.mode.userefreshrate;
vid.stereobuffer = vid.mode.stereobuffer;
vid.samples = vid.mode.samples;
- gl_stencil = vid.mode.bitsperpixel > 16;
+ vid.stencil = vid.mode.bitsperpixel > 16;
Con_Printf("Video Mode: %s %dx%dx%dx%.2fhz%s%s\n", mode.fullscreen ? "fullscreen" : "window", mode.width, mode.height, mode.bitsperpixel, mode.refreshrate, mode.stereobuffer ? " stereo" : "", mode.samples > 1 ? va(" (%ix AA)", mode.samples) : "");
Cvar_SetValueQuick(&vid_fullscreen, vid.mode.fullscreen);