SCR_ClearLoadingScreenTexture();
- if (gl_support_arb_texture_non_power_of_two)
+ if (vid.support.arb_texture_non_power_of_two)
{
w = vid.width; h = vid.height;
loadingscreentexture_w = loadingscreentexture_h = 1;
Cvar_Set ("fov","170");
// validate r_textureunits cvar
- if (r_textureunits.integer > gl_textureunits)
- Cvar_SetValueQuick(&r_textureunits, gl_textureunits);
+ if (r_textureunits.integer > (int)vid.texunits)
+ Cvar_SetValueQuick(&r_textureunits, vid.texunits);
if (r_textureunits.integer < 1)
Cvar_SetValueQuick(&r_textureunits, 1);
// validate gl_combine cvar
- if (gl_combine.integer && !gl_combine_extension)
+ if (gl_combine.integer && !vid.support.arb_texture_env_combine)
Cvar_SetValueQuick(&gl_combine, 0);
// intermission is always full screen
Con_DPrintf("GL_MAX_ELEMENTS_VERTICES = %i\nGL_MAX_ELEMENTS_INDICES = %i\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
}
- if (gl_support_fragment_shader)
+ if (vid.support.arb_fragment_shader)
{
Con_DPrintf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", vid.texunits, vid.teximageunits, vid.texarrayunits);
vid.teximageunits = bound(1, vid.teximageunits, MAX_TEXTUREUNITS);
{
GL_ActiveTexture(i);
qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
- if (gl_texture3d)
+ if (vid.support.ext_texture_3d)
{
qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR
}
- if (gl_texturecubemap)
+ if (vid.support.arb_texture_cube_map)
{
qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR
}
- if (gl_texturerectangle)
+ if (vid.support.arb_texture_rectangle)
{
qglBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);CHECKGLERROR
}
{
GL_ActiveTexture(i);
qglDisable(GL_TEXTURE_2D);CHECKGLERROR
- if (gl_texture3d)
+ if (vid.support.ext_texture_3d)
{
qglDisable(GL_TEXTURE_3D);CHECKGLERROR
}
- if (gl_texturecubemap)
+ if (vid.support.arb_texture_cube_map)
{
qglDisable(GL_TEXTURE_CUBE_MAP_ARB);CHECKGLERROR
}
- if (gl_texturerectangle)
+ if (vid.support.arb_texture_rectangle)
{
qglDisable(GL_TEXTURE_RECTANGLE_ARB);CHECKGLERROR
}
qglDepthMask(gl_state.depthmask);CHECKGLERROR
qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]);
- if (gl_support_arb_vertex_buffer_object)
+ if (vid.support.arb_vertex_buffer_object)
{
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
- if (gl_support_ext_framebuffer_object)
+ if (vid.support.ext_framebuffer_object)
{
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
qglUnlockArraysEXT();
CHECKGLERROR
}
- if (count && gl_supportslockarrays && gl_lockarrays.integer)
+ if (count && vid.support.ext_compiled_vertex_array && gl_lockarrays.integer)
{
gl_state.lockrange_first = first;
gl_state.lockrange_count = count;
{
GL_ActiveTexture(i);
qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
- if (gl_texture3d)
+ if (vid.support.ext_texture_3d)
{
qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR
}
- if (gl_texturecubemap)
+ if (vid.support.arb_texture_cube_map)
{
qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR
}
- if (gl_texturerectangle)
+ if (vid.support.arb_texture_rectangle)
{
qglBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);CHECKGLERROR
}
{
GL_ActiveTexture(vid.texunits - 1 - i);
qglDisable(GL_TEXTURE_2D);CHECKGLERROR
- if (gl_texture3d)
+ if (vid.support.ext_texture_3d)
{
qglDisable(GL_TEXTURE_3D);CHECKGLERROR
}
- if (gl_texturecubemap)
+ if (vid.support.arb_texture_cube_map)
{
qglDisable(GL_TEXTURE_CUBE_MAP_ARB);CHECKGLERROR
}
- if (gl_texturerectangle)
+ if (vid.support.arb_texture_rectangle)
{
qglDisable(GL_TEXTURE_RECTANGLE_ARB);CHECKGLERROR
}
void R_SetupGenericShader(qboolean usetexture)
{
- if (gl_support_fragment_shader)
+ if (vid.support.arb_fragment_shader)
{
if (r_glsl.integer && r_glsl_usegeneric.integer)
R_SetupShader_SetPermutation(SHADERMODE_GENERIC, usetexture ? SHADERPERMUTATION_DIFFUSE : 0);
void R_SetupGenericTwoTextureShader(int texturemode)
{
- if (gl_support_fragment_shader)
+ if (vid.support.arb_fragment_shader)
{
if (r_glsl.integer && r_glsl_usegeneric.integer)
R_SetupShader_SetPermutation(SHADERMODE_GENERIC, SHADERPERMUTATION_DIFFUSE | SHADERPERMUTATION_SPECULAR | (r_shadow_glossexact.integer ? SHADERPERMUTATION_EXACTSPECULARMATH : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0))));
void R_SetupDepthOrShadowShader(void)
{
- if (gl_support_fragment_shader)
+ if (vid.support.arb_fragment_shader)
{
if (r_glsl.integer && r_glsl_usegeneric.integer)
R_SetupShader_SetPermutation(SHADERMODE_DEPTH_OR_SHADOW, 0);
void R_SetupShowDepthShader(void)
{
- if (gl_support_fragment_shader)
+ if (vid.support.arb_fragment_shader)
{
if (r_glsl.integer && r_glsl_usegeneric.integer)
R_SetupShader_SetPermutation(SHADERMODE_SHOWDEPTH, 0);
void gl_main_start(void)
{
- r_loadnormalmap = r_loadgloss = gl_dot3arb || gl_support_fragment_shader;
+ r_loadnormalmap = r_loadgloss = vid.support.arb_texture_env_dot3 || vid.support.arb_fragment_shader;
r_loadfog = true;
r_numqueries = 0;
r_main_texturepool = R_AllocTexturePool();
R_BuildBlankTextures();
R_BuildNoTexture();
- if (gl_texturecubemap)
+ if (vid.support.arb_texture_cube_map)
{
R_BuildWhiteCube();
R_BuildNormalizationCube();
vec3_t start;
vec3_t end;
dp_model_t *model = r_refdef.scene.worldmodel;
-
+
if (!model || !model->brush.TraceLineOfSight)
return true;
// calculate desired texture sizes
// can't use water if the card does not support the texture size
- if (!r_water.integer || !r_glsl.integer || !gl_support_fragment_shader || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size || r_showsurfaces.integer)
+ if (!r_water.integer || !r_glsl.integer || !vid.support.arb_fragment_shader || waterwidth > (int)vid.maxtexturesize_2d || waterheight > (int)vid.maxtexturesize_2d || r_showsurfaces.integer)
texturewidth = textureheight = waterwidth = waterheight = 0;
- else if (gl_support_arb_texture_non_power_of_two)
+ else if (vid.support.arb_texture_non_power_of_two)
{
texturewidth = waterwidth;
textureheight = waterheight;
r_bloomstate.bloomwidth = bound(1, r_bloom_resolution.integer, vid.height);
r_bloomstate.bloomheight = r_bloomstate.bloomwidth * vid.height / vid.width;
r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, vid.height);
- r_bloomstate.bloomwidth = bound(1, r_bloomstate.bloomwidth, gl_max_texture_size);
- r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, gl_max_texture_size);
+ r_bloomstate.bloomwidth = bound(1, r_bloomstate.bloomwidth, (int)vid.maxtexturesize_2d);
+ r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, (int)vid.maxtexturesize_2d);
// calculate desired texture sizes
- if (gl_support_arb_texture_non_power_of_two)
+ if (vid.support.arb_texture_non_power_of_two)
{
screentexturewidth = r_refdef.view.width;
screentextureheight = r_refdef.view.height;
for (bloomtextureheight = 1;bloomtextureheight < r_bloomstate.bloomheight;bloomtextureheight *= 2);
}
- if ((r_hdr.integer || r_bloom.integer || (!R_Stereo_Active() && (r_motionblur.value > 0 || r_damageblur.value > 0))) && ((r_bloom_resolution.integer < 4 || r_bloom_blur.value < 1 || r_bloom_blur.value >= 512) || r_refdef.view.width > gl_max_texture_size || r_refdef.view.height > gl_max_texture_size))
+ if ((r_hdr.integer || r_bloom.integer || (!R_Stereo_Active() && (r_motionblur.value > 0 || r_damageblur.value > 0))) && ((r_bloom_resolution.integer < 4 || r_bloom_blur.value < 1 || r_bloom_blur.value >= 512) || r_refdef.view.width > (int)vid.maxtexturesize_2d || r_refdef.view.height > (int)vid.maxtexturesize_2d))
{
Cvar_SetValueQuick(&r_hdr, 0);
Cvar_SetValueQuick(&r_bloom, 0);
// apply subtract last
// (just like it would be in a GLSL shader)
- if (r_bloom_colorsubtract.value > 0 && gl_support_ext_blend_subtract)
+ if (r_bloom_colorsubtract.value > 0 && vid.support.ext_blend_subtract)
{
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
r_refdef.stats.bloom_copypixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
- if (r_glsl.integer && gl_support_fragment_shader && (r_bloomstate.texture_screen || r_bloomstate.texture_bloom))
+ if (r_glsl.integer && vid.support.arb_fragment_shader && (r_bloomstate.texture_screen || r_bloomstate.texture_bloom))
{
unsigned int permutation =
(r_bloomstate.texture_bloom ? SHADERPERMUTATION_BLOOM : 0)
r_refdef.view.clear = true;
// this produces a bloom texture to be used in R_BlendView() later
- if (r_hdr.integer)
+ if (r_hdr.integer && r_bloomstate.bloomwidth)
R_HDR_RenderBloomTexture();
r_refdef.view.showdebug = true;
RSurf_SetupDepthAndCulling();
if (r_showsurfaces.integer == 3)
R_DrawTextureSurfaceList_ShowSurfaces3(texturenumsurfaces, texturesurfacelist, writedepth);
- else if (r_glsl.integer && gl_support_fragment_shader)
+ else if (r_glsl.integer && vid.support.arb_fragment_shader)
R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth);
else if (gl_combine.integer && r_textureunits.integer >= 2)
R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth);
RSurf_SetupDepthAndCulling();
if (r_showsurfaces.integer == 3)
R_DrawTextureSurfaceList_ShowSurfaces3(texturenumsurfaces, texturesurfacelist, writedepth);
- else if (r_glsl.integer && gl_support_fragment_shader)
+ else if (r_glsl.integer && vid.support.arb_fragment_shader)
R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth);
else if (gl_combine.integer && r_textureunits.integer >= 2)
R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth);
else if (r_showsurfaces.integer && r_showsurfaces.integer != 3)
RSurf_ActiveModelEntity(ent, false, false);
else
- RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader);
+ RSurf_ActiveModelEntity(ent, true, r_glsl.integer && vid.support.arb_fragment_shader);
for (i = 0;i < numsurfaces;i = j)
{
RSurf_ActiveWorldEntity();
else if (r_showsurfaces.integer && r_showsurfaces.integer != 3)
RSurf_ActiveModelEntity(ent, false, false);
+ else if (depthonly)
+ RSurf_ActiveModelEntity(ent, false, false);
else
- RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader && !depthonly);
+ RSurf_ActiveModelEntity(ent, true, r_glsl.integer && vid.support.arb_fragment_shader);
surfaces = model->data_surfaces;
update = model->brushq1.lightmapupdateflags;
// palette if the texture is TEXTYPE_PALETTE
const unsigned int *palette;
// actual stored texture size after gl_picmip and gl_max_size are applied
- // (power of 2 if gl_support_arb_texture_non_power_of_two is not supported)
+ // (power of 2 if vid.support.arb_texture_non_power_of_two is not supported)
int tilewidth, tileheight, tiledepth;
// 1 or 6 depending on texturetype
int sides;
static textypeinfo_t *R_GetTexTypeInfo(textype_t textype, int flags)
{
- if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && gl_support_texture_compression)
+ if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.arb_texture_compression)
{
if (flags & TEXF_ALPHA)
{
{
int picmip = 0, maxsize = 0, width2 = 1, height2 = 1, depth2 = 1;
- if (gl_max_size.integer > gl_max_texture_size)
- Cvar_SetValue("gl_max_size", gl_max_texture_size);
+ if (gl_max_size.integer > (int)vid.maxtexturesize_2d)
+ Cvar_SetValue("gl_max_size", vid.maxtexturesize_2d);
switch (texturetype)
{
default:
case GLTEXTURETYPE_2D:
- maxsize = gl_max_texture_size;
+ maxsize = vid.maxtexturesize_2d;
break;
case GLTEXTURETYPE_3D:
- maxsize = gl_max_3d_texture_size;
+ maxsize = vid.maxtexturesize_3d;
break;
case GLTEXTURETYPE_CUBEMAP:
- maxsize = gl_max_cube_map_texture_size;
+ maxsize = vid.maxtexturesize_cubemap;
break;
}
if (outwidth)
{
- if (gl_support_arb_texture_non_power_of_two)
+ if (vid.support.arb_texture_non_power_of_two)
width2 = min(inwidth >> picmip, maxsize);
else
{
}
if (outheight)
{
- if (gl_support_arb_texture_non_power_of_two)
+ if (vid.support.arb_texture_non_power_of_two)
height2 = min(inheight >> picmip, maxsize);
else
{
}
if (outdepth)
{
- if (gl_support_arb_texture_non_power_of_two)
+ if (vid.support.arb_texture_non_power_of_two)
depth2 = min(indepth >> picmip, maxsize);
else
{
gltexturepool_t *pool;
GLint oldbindtexnum;
- old_aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy);
+ old_aniso = bound(1, gl_texture_anisotropy.integer, (int)vid.max_anisotropy);
Cvar_SetValueQuick(&gl_texture_anisotropy, old_aniso);
static void GL_SetupTextureParameters(int flags, textype_t textype, int texturetype)
{
int textureenum = gltexturetypeenums[texturetype];
- int wrapmode = ((flags & TEXF_CLAMP) && gl_support_clamptoedge) ? GL_CLAMP_TO_EDGE : GL_REPEAT;
+ int wrapmode = (flags & TEXF_CLAMP) ? GL_CLAMP_TO_EDGE : GL_REPEAT;
CHECKGLERROR
- if (gl_support_anisotropy && (flags & TEXF_MIPMAP))
+ if (vid.support.ext_texture_filter_anisotropic && (flags & TEXF_MIPMAP))
{
- int aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy);
+ int aniso = bound(1, gl_texture_anisotropy.integer, (int)vid.max_anisotropy);
if (gl_texture_anisotropy.integer != aniso)
Cvar_SetValueQuick(&gl_texture_anisotropy, aniso);
qglTexParameteri(textureenum, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);CHECKGLERROR
if (textype == TEXTYPE_SHADOWMAP)
{
- if (gl_support_arb_shadow)
+ if (vid.support.arb_shadow)
{
if (flags & TEXF_COMPARE)
{
qglBindTexture(gltexturetypeenums[glt->texturetype], glt->texnum);CHECKGLERROR
// these are rounded up versions of the size to do better resampling
- if (gl_support_arb_texture_non_power_of_two || glt->texturetype == GLTEXTURETYPE_RECTANGLE)
+ if (vid.support.arb_texture_non_power_of_two || glt->texturetype == GLTEXTURETYPE_RECTANGLE)
{
width = glt->inputwidth;
height = glt->inputheight;
}
}
mip = 0;
- if (gl_support_texture_compression)
+ if (vid.support.arb_texture_compression)
{
if (gl_texturecompression.integer >= 2)
qglHint(GL_TEXTURE_COMPRESSION_HINT_ARB, GL_NICEST);
if (cls.state == ca_dedicated)
return NULL;
- if (texturetype == GLTEXTURETYPE_RECTANGLE && !gl_texturerectangle)
+ if (texturetype == GLTEXTURETYPE_RECTANGLE && !vid.support.arb_texture_rectangle)
{
Con_Printf ("R_LoadTexture: rectangle texture not supported by driver\n");
return NULL;
}
- if (texturetype == GLTEXTURETYPE_CUBEMAP && !gl_texturecubemap)
+ if (texturetype == GLTEXTURETYPE_CUBEMAP && !vid.support.arb_texture_cube_map)
{
Con_Printf ("R_LoadTexture: cubemap texture not supported by driver\n");
return NULL;
}
- if (texturetype == GLTEXTURETYPE_3D && !gl_texture3d)
+ if (texturetype == GLTEXTURETYPE_3D && !vid.support.ext_texture_3d)
{
Con_Printf ("R_LoadTexture: 3d texture not supported by driver\n");
return NULL;
#endif
//GL_EXT_texture_filter_anisotropic
-extern int gl_support_anisotropy;
-extern int gl_max_anisotropy;
#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#endif
// GL_ARB_shadow
-extern int gl_support_arb_shadow;
#ifndef GL_TEXTURE_COMPARE_MODE_ARB
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
#endif
-extern int gl_max_texture_size;
-
// GL_ARB_multitexture
-extern int gl_textureunits;
extern void (GLAPIENTRY *qglMultiTexCoord1f) (GLenum, GLfloat);
extern void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
extern void (GLAPIENTRY *qglMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat);
#endif
// GL_EXT_compiled_vertex_array
-extern int gl_supportslockarrays;
extern void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
extern void (GLAPIENTRY *qglUnlockArraysEXT) (void);
// GL_ARB_texture_env_combine
-extern int gl_combine_extension;
#ifndef GL_COMBINE_ARB
#define GL_COMBINE_ARB 0x8570
#define GL_COMBINE_RGB_ARB 0x8571
#endif
-extern int gl_texture3d;
-extern int gl_max_3d_texture_size;
#ifndef GL_TEXTURE_3D
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
extern void (GLAPIENTRY *qglCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
#endif
-extern int gl_texturecubemap;
-extern int gl_max_cube_map_texture_size;
#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
#define GL_NORMAL_MAP_ARB 0x8511
#define GL_REFLECTION_MAP_ARB 0x8512
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
#endif
-extern int gl_texturerectangle;
-extern int gl_max_rectangle_texture_size;
#ifndef GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
#endif
-extern int gl_depthtexture;
#ifndef GL_DEPTH_COMPONENT16_ARB
#define GL_DEPTH_COMPONENT16_ARB 0x81A5
#define GL_DEPTH_COMPONENT24_ARB 0x81A6
#endif
-extern int gl_dot3arb;
#ifndef GL_DOT3_RGB_ARB
#define GL_DOT3_RGB_ARB 0x86AE
#define GL_DOT3_RGBA_ARB 0x86AF
#endif
// GL_SGIS_texture_edge_clamp or GL_EXT_texture_edge_clamp
-extern int gl_support_clamptoedge;
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
//GL_ATI_separate_stencil
-extern int gl_support_separatestencil;
#ifndef GL_STENCIL_BACK_FUNC
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
extern void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum);
-extern int gl_support_stenciltwoside;
//GL_EXT_blend_minmax
-extern int gl_support_ext_blend_minmax;
#ifndef GL_FUNC_ADD_EXT
#define GL_FUNC_ADD_EXT 0x8006 // also supplied by GL_EXT_blend_subtract
#define GL_MIN_EXT 0x8007
#endif
//GL_EXT_blend_subtract
-extern int gl_support_ext_blend_subtract;
#ifndef GL_FUNC_SUBTRACT_EXT
#define GL_FUNC_SUBTRACT_EXT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B
#endif
//GL_ARB_texture_non_power_of_two
-extern int gl_support_arb_texture_non_power_of_two;
//GL_ARB_vertex_buffer_object
-extern int gl_support_arb_vertex_buffer_object;
#ifndef GL_ARRAY_BUFFER_ARB
#define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
extern void (GLAPIENTRY *qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
//GL_EXT_framebuffer_object
-extern int gl_support_ext_framebuffer_object;
#ifndef GL_FRAMEBUFFER_EXT
#define GL_FRAMEBUFFER_EXT 0x8D40
#define GL_RENDERBUFFER_EXT 0x8D41
extern void (GLAPIENTRY *qglPointSize)(GLfloat size);
// GL_ARB_shader_objects
-extern int gl_support_shader_objects;
#ifndef GL_PROGRAM_OBJECT_ARB
// 1-byte character string
typedef char GLcharARB;
#endif
// GL_ARB_vertex_shader
-extern int gl_support_vertex_shader;
//extern void (GLAPIENTRY *qglVertexAttrib1fARB)(GLuint index, GLfloat v0);
//extern void (GLAPIENTRY *qglVertexAttrib1sARB)(GLuint index, GLshort v0);
//extern void (GLAPIENTRY *qglVertexAttrib1dARB)(GLuint index, GLdouble v0);
#endif
// GL_ARB_fragment_shader
-extern int gl_support_fragment_shader;
#ifndef GL_FRAGMENT_SHADER_ARB
#define GL_FRAGMENT_SHADER_ARB 0x8B30
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
#endif
// GL_ARB_shading_language_100
-extern int gl_support_shading_language_100;
#ifndef GL_SHADING_LANGUAGE_VERSION_ARB
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
#endif
// GL_ARB_texture_compression
-extern int gl_support_texture_compression;
extern void (GLAPIENTRY *qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
extern void (GLAPIENTRY *qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
//extern void (GLAPIENTRY *qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
#endif
// GL_ARB_occlusion_query
-extern int gl_support_arb_occlusion_query;
extern void (GLAPIENTRY *qglGenQueriesARB)(GLsizei n, GLuint *ids);
extern void (GLAPIENTRY *qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
extern GLboolean (GLAPIENTRY *qglIsQueryARB)(GLuint qid);
#define GL_BGRA 0x80E1
//GL_AMD_texture_texture4
-extern int gl_support_amd_texture_texture4;
//GL_ARB_texture_gather
-extern int gl_support_arb_texture_gather;
#define DEBUGGL
M_DrawCheckbox(220, video_cursor_table[t], vid_vsync.integer);
t++;
- M_ItemPrint(16, video_cursor_table[t], " Anisotropic Filter", gl_support_anisotropy);
- M_DrawSlider(220, video_cursor_table[t], gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
+ M_ItemPrint(16, video_cursor_table[t], " Anisotropic Filter", vid.support.ext_texture_filter_anisotropic);
+ M_DrawSlider(220, video_cursor_table[t], gl_texture_anisotropy.integer, 1, vid.max_anisotropy);
t++;
M_ItemPrint(16, video_cursor_table[t], " Texture Quality", true);
M_DrawSlider(220, video_cursor_table[t], gl_picmip.value, 3, 0);
t++;
- M_ItemPrint(16, video_cursor_table[t], " Texture Compression", gl_support_texture_compression);
+ M_ItemPrint(16, video_cursor_table[t], " Texture Compression", vid.support.arb_texture_compression);
M_DrawCheckbox(220, video_cursor_table[t], gl_texturecompression.integer);
t++;
else if (video_cursor == t++)
Cvar_SetValueQuick (&vid_vsync, !vid_vsync.integer);
else if (video_cursor == t++)
- Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.value * (dir < 0 ? 0.5 : 2.0), gl_max_anisotropy));
+ Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.value * (dir < 0 ? 0.5 : 2.0), vid.max_anisotropy));
else if (video_cursor == t++)
Cvar_SetValueQuick (&gl_picmip, bound(0, gl_picmip.value - dir, 3));
else if (video_cursor == t++)
;
// i is now 0 for 128, 1 for 256, etc
- for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= gl_max_texture_size && (1 << (power * 2)) < 4 * (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)); power++)
+ for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= (int)vid.maxtexturesize_2d && (1 << (power * 2)) < 4 * (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)); power++)
loadmodel->brushq3.num_lightmapmergepower = power;
loadmodel->brushq3.num_lightmapmerge = 1 << loadmodel->brushq3.num_lightmapmergepower;
static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
{
- if (!gl_support_arb_vertex_buffer_object)
+ if (!vid.support.arb_vertex_buffer_object)
return;
// element buffer is easy because it's just one array
}
}
- if (!gl_support_arb_vertex_buffer_object)
+ if (!vid.support.arb_vertex_buffer_object)
return;
// element buffer is easy because it's just one array
model->texturepool = R_AllocTexturePool();
lm_basescalepixels = 1.0f / max(0.0001f, mod_generatelightmaps_unitspersample.value);
lm_borderpixels = mod_generatelightmaps_borderpixels.integer;
- lm_texturesize = bound(lm_borderpixels*2+1, 64, gl_max_texture_size);
+ lm_texturesize = bound(lm_borderpixels*2+1, 64, (int)vid.maxtexturesize_2d);
lm_maxpixels = lm_texturesize-(lm_borderpixels*2+1);
Mod_AllocLightmap_Init(&lmstate, lm_texturesize, lm_texturesize);
lightmapnumber = 0;
break;
// if we haven't maxed out the lightmap size yet, we retry the
// entire surface batch...
- if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, gl_max_texture_size))
+ if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, (int)vid.maxtexturesize_2d))
{
lm_texturesize *= 2;
surfaceindex = -1;
r_shadow_shadowmapsampler = false;
r_shadow_shadowmappcf = 0;
r_shadow_shadowmode = R_SHADOW_SHADOWMODE_STENCIL;
- if(r_shadow_shadowmapping.integer && r_glsl.integer && gl_support_fragment_shader && gl_support_ext_framebuffer_object)
+ if(r_shadow_shadowmapping.integer && r_glsl.integer && vid.support.arb_fragment_shader && vid.support.ext_framebuffer_object)
{
if(r_shadow_shadowmapfilterquality < 0)
{
if(strstr(gl_vendor, "NVIDIA"))
{
- r_shadow_shadowmapsampler = gl_support_arb_shadow;
+ r_shadow_shadowmapsampler = vid.support.arb_shadow;
r_shadow_shadowmappcf = 1;
}
- else if(gl_support_amd_texture_texture4 || gl_support_arb_texture_gather)
+ else if(vid.support.amd_texture_texture4 || vid.support.arb_texture_gather)
r_shadow_shadowmappcf = 1;
else if(strstr(gl_vendor, "ATI"))
r_shadow_shadowmappcf = 1;
else
- r_shadow_shadowmapsampler = gl_support_arb_shadow;
+ r_shadow_shadowmapsampler = vid.support.arb_shadow;
}
else
{
switch (r_shadow_shadowmapfilterquality)
{
case 1:
- r_shadow_shadowmapsampler = gl_support_arb_shadow;
+ r_shadow_shadowmapsampler = vid.support.arb_shadow;
break;
case 2:
- r_shadow_shadowmapsampler = gl_support_arb_shadow;
+ r_shadow_shadowmapsampler = vid.support.arb_shadow;
r_shadow_shadowmappcf = 1;
break;
case 3:
r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE;
break;
default:
- if((gl_support_amd_texture_texture4 || gl_support_arb_texture_gather) && r_shadow_shadowmappcf && !r_shadow_shadowmapsampler)
+ if((vid.support.amd_texture_texture4 || vid.support.arb_texture_gather) && r_shadow_shadowmappcf && !r_shadow_shadowmapsampler)
r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D;
- else if(gl_texturerectangle)
+ else if(vid.support.arb_texture_rectangle)
r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAPRECTANGLE;
else
r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D;
data[y*ATTEN2DSIZE+x] = R_Shadow_MakeTextures_SamplePoint(((x + 0.5f) * (2.0f / ATTEN2DSIZE) - 1.0f) * (1.0f / 0.9375), ((y + 0.5f) * (2.0f / ATTEN2DSIZE) - 1.0f) * (1.0f / 0.9375), 0);
r_shadow_attenuation2dtexture = R_LoadTexture2D(r_shadow_texturepool, "attenuation2d", ATTEN2DSIZE, ATTEN2DSIZE, (unsigned char *)data, TEXTYPE_BGRA, TEXF_PRECACHE | TEXF_CLAMP | TEXF_ALPHA | TEXF_FORCELINEAR, NULL);
// 3D sphere texture
- if (r_shadow_texture3d.integer && gl_texture3d)
+ if (r_shadow_texture3d.integer && vid.support.ext_texture_3d)
{
for (z = 0;z < ATTEN3DSIZE;z++)
for (y = 0;y < ATTEN3DSIZE;y++)
void R_Shadow_ValidateCvars(void)
{
- if (r_shadow_texture3d.integer && !gl_texture3d)
+ if (r_shadow_texture3d.integer && !vid.support.ext_texture_3d)
Cvar_SetValueQuick(&r_shadow_texture3d, 0);
- if (gl_ext_separatestencil.integer && !gl_support_separatestencil)
+ if (gl_ext_separatestencil.integer && !vid.support.ati_separate_stencil)
Cvar_SetValueQuick(&gl_ext_separatestencil, 0);
- if (gl_ext_stenciltwoside.integer && !gl_support_stenciltwoside)
+ if (gl_ext_stenciltwoside.integer && !vid.support.ext_stencil_two_side)
Cvar_SetValueQuick(&gl_ext_stenciltwoside, 0);
}
r_shadow_shadowingrendermode_zfail = R_SHADOW_RENDERMODE_ZFAIL_STENCIL;
}
- if (r_glsl.integer && gl_support_fragment_shader)
+ if (r_glsl.integer && vid.support.arb_fragment_shader)
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_GLSL;
- else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && vid.stencil)
+ else if (vid.support.arb_texture_env_dot3 && vid.support.arb_texture_cube_map && r_shadow_dot3.integer && vid.stencil)
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_DOT3;
else
r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX;
{
qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);CHECKGLERROR
}
- if (gl_support_ext_framebuffer_object)
+ if (vid.support.ext_framebuffer_object)
{
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);CHECKGLERROR
}
if (!r_shadow_shadowmap2dtexture)
{
#if 1
- int w = maxsize*2, h = gl_support_arb_texture_non_power_of_two ? maxsize*3 : maxsize*4;
+ int w = maxsize*2, h = vid.support.arb_texture_non_power_of_two ? maxsize*3 : maxsize*4;
r_shadow_shadowmap2dtexture = R_LoadTextureShadowMap2D(r_shadow_texturepool, "shadowmap", w, h, r_shadow_shadowmapdepthbits, r_shadow_shadowmapsampler);
qglGenFramebuffersEXT(1, &r_shadow_fbo2d);CHECKGLERROR
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, r_shadow_fbo2d);CHECKGLERROR
}
if ((ambientscale + diffusescale) * VectorLength2(lightcolorbase) + specularscale * VectorLength2(lightcolorbase) < (1.0f / 1048576.0f))
return;
- negated = (lightcolorbase[0] + lightcolorbase[1] + lightcolorbase[2] < 0) && gl_support_ext_blend_subtract;
+ negated = (lightcolorbase[0] + lightcolorbase[1] + lightcolorbase[2] < 0) && vid.support.ext_blend_subtract;
if(negated)
{
VectorNegate(lightcolorbase, lightcolorbase);
}
// return if there's nothing at all to light
- if (!numlightentities && !numsurfaces)
+ if (numsurfaces + numlightentities + numlightentities_noselfshadow == 0)
return;
// don't let sound skip if going slow
// so that they won't receive lighting
GL_Scissor(r_shadow_lightscissor[0], r_shadow_lightscissor[1], r_shadow_lightscissor[2], r_shadow_lightscissor[3]);
R_Shadow_ClearStencil();
- if (numsurfaces)
- R_Shadow_DrawWorldShadow_ShadowVolume(numsurfaces, surfacelist, shadowtrispvs);
- for (i = 0;i < numshadowentities;i++)
- R_Shadow_DrawEntityShadow(shadowentities[i]);
+
+ if (numsurfaces + numshadowentities)
+ {
+ if (numsurfaces)
+ R_Shadow_DrawWorldShadow_ShadowVolume(numsurfaces, surfacelist, shadowtrispvs);
+ for (i = 0;i < numshadowentities;i++)
+ R_Shadow_DrawEntityShadow(shadowentities[i]);
+ }
+
if (numlightentities_noselfshadow)
{
// draw lighting in the unmasked areas
for (i = 0;i < numlightentities_noselfshadow;i++)
R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
}
+ for (i = 0;i < numshadowentities_noselfshadow;i++)
+ R_Shadow_DrawEntityShadow(shadowentities[shadowentities_noselfshadow - i]);
}
- for (i = 0;i < numshadowentities_noselfshadow;i++)
- R_Shadow_DrawEntityShadow(shadowentities[shadowentities_noselfshadow - i]);
if (numsurfaces + numlightentities)
{
}
else
{
- if (numsurfaces + numlightentities)
- {
- // draw lighting in the unmasked areas
- R_Shadow_RenderMode_Lighting(false, false, false);
- if (numsurfaces)
- R_Shadow_DrawWorldLight(numsurfaces, surfacelist, lighttrispvs);
- for (i = 0;i < numlightentities;i++)
- R_Shadow_DrawEntityLight(lightentities[i]);
- for (i = 0;i < numlightentities_noselfshadow;i++)
- R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
- }
+ // draw lighting in the unmasked areas
+ R_Shadow_RenderMode_Lighting(false, false, false);
+ if (numsurfaces)
+ R_Shadow_DrawWorldLight(numsurfaces, surfacelist, lighttrispvs);
+ for (i = 0;i < numlightentities;i++)
+ R_Shadow_DrawEntityLight(lightentities[i]);
+ for (i = 0;i < numlightentities_noselfshadow;i++)
+ R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
}
}
float f;
if (r_shadow_shadowmapmaxsize != bound(1, r_shadow_shadowmapping_maxsize.integer, gl_max_size.integer / 4) ||
- (r_shadow_shadowmode != R_SHADOW_SHADOWMODE_STENCIL) != (r_shadow_shadowmapping.integer && r_glsl.integer && gl_support_fragment_shader && gl_support_ext_framebuffer_object) ||
+ (r_shadow_shadowmode != R_SHADOW_SHADOWMODE_STENCIL) != (r_shadow_shadowmapping.integer && r_glsl.integer && vid.support.arb_fragment_shader && vid.support.ext_framebuffer_object) ||
r_shadow_shadowmapvsdct != (r_shadow_shadowmapping_vsdct.integer != 0) ||
r_shadow_shadowmaptexturetype != r_shadow_shadowmapping_texturetype.integer ||
r_shadow_shadowmapfilterquality != r_shadow_shadowmapping_filterquality.integer ||
if (VectorLength(color) > (1.0f / 256.0f))
{
float vertex3f[12];
- qboolean negated = (color[0] + color[1] + color[2] < 0) && gl_support_ext_blend_subtract;
+ qboolean negated = (color[0] + color[1] + color[2] < 0) && vid.support.ext_blend_subtract;
if(negated)
{
VectorNegate(color, color);
// use GL_ARB_occlusion_query if available
// otherwise use raytraces
r_numqueries = 0;
- usequery = gl_support_arb_occlusion_query && r_coronas_occlusionquery.integer;
+ usequery = vid.support.arb_occlusion_query && r_coronas_occlusionquery.integer;
if (usequery)
{
GL_ColorMask(0,0,0,0);
float in_mouse_x, in_mouse_y;
float in_windowmouse_x, in_windowmouse_y;
-// value of GL_MAX_TEXTURE_<various>_SIZE
-int gl_max_texture_size = 0;
-int gl_max_3d_texture_size = 0;
-int gl_max_cube_map_texture_size = 0;
-int gl_max_rectangle_texture_size = 0;
-// GL_ARB_multitexture
-int gl_textureunits = 1;
-// GL_ARB_texture_env_combine or GL_EXT_texture_env_combine
-int gl_combine_extension = false;
-// GL_EXT_compiled_vertex_array
-int gl_supportslockarrays = false;
-// 3D textures available
-int gl_texture3d = false;
-// GL_ARB_texture_cubemap
-int gl_texturecubemap = false;
-// GL_ARB_texture_rectangle
-int gl_texturerectangle = false;
-// GL_ARB_texture_non_power_of_two
-int gl_support_arb_texture_non_power_of_two = false;
-// GL_ARB_texture_env_dot3
-int gl_dot3arb = false;
-// GL_ARB_depth_texture
-int gl_depthtexture = false;
-// GL_ARB_shadow
-int gl_support_arb_shadow = false;
-// GL_SGIS_texture_edge_clamp
-int gl_support_clamptoedge = false;
-// GL_EXT_texture_filter_anisotropic
-int gl_support_anisotropy = false;
-int gl_max_anisotropy = 1;
-// OpenGL2.0 core glStencilOpSeparate, or GL_ATI_separate_stencil
-int gl_support_separatestencil = false;
-// GL_EXT_stencil_two_side
-int gl_support_stenciltwoside = false;
-// GL_EXT_blend_minmax
-int gl_support_ext_blend_minmax = false;
-// GL_EXT_blend_subtract
-int gl_support_ext_blend_subtract = false;
-// GL_ARB_shader_objects
-int gl_support_shader_objects = false;
-// GL_ARB_shading_language_100
-int gl_support_shading_language_100 = false;
-// GL_ARB_vertex_shader
-int gl_support_vertex_shader = false;
-// GL_ARB_fragment_shader
-int gl_support_fragment_shader = false;
-//GL_ARB_vertex_buffer_object
-int gl_support_arb_vertex_buffer_object = false;
-//GL_EXT_framebuffer_object
-int gl_support_ext_framebuffer_object = false;
-//GL_ARB_texture_compression
-int gl_support_texture_compression = false;
-//GL_ARB_occlusion_query
-int gl_support_arb_occlusion_query = false;
-//GL_AMD_texture_texture4
-int gl_support_amd_texture_texture4 = false;
-//GL_ARB_texture_gather
-int gl_support_arb_texture_gather = false;
-
// LordHavoc: if window is hidden, don't update screen
qboolean vid_hidden = true;
// LordHavoc: if window is not the active window, don't hog as much CPU time,
vid.renderpath = RENDERPATH_GL11;
}
- gl_max_texture_size = vid.maxtexturesize_2d;
- gl_max_3d_texture_size = vid.maxtexturesize_3d;
- gl_max_cube_map_texture_size = vid.maxtexturesize_cubemap;
- gl_textureunits = vid.texunits;
- gl_max_anisotropy = vid.max_anisotropy;
-
- gl_combine_extension = vid.support.arb_texture_env_combine;
- gl_supportslockarrays = vid.support.ext_compiled_vertex_array;
- gl_texture3d = vid.support.ext_texture_3d;
- gl_texturecubemap = vid.support.arb_texture_cube_map;
- gl_texturerectangle = vid.support.arb_texture_rectangle;
- gl_support_arb_texture_non_power_of_two = vid.support.arb_texture_non_power_of_two;
- gl_dot3arb = vid.support.arb_texture_env_dot3;
- gl_depthtexture = vid.support.arb_depth_texture;
- gl_support_arb_shadow = vid.support.arb_shadow;
- gl_support_clamptoedge = vid.support.ext_texture_edge_clamp;
- gl_support_anisotropy = vid.support.ext_texture_filter_anisotropic;
- gl_support_separatestencil = vid.support.ati_separate_stencil;
- gl_support_stenciltwoside = vid.support.ext_stencil_two_side;
- gl_support_ext_blend_minmax = vid.support.ext_blend_minmax;
- gl_support_ext_blend_subtract = vid.support.ext_blend_subtract;
- gl_support_shader_objects = vid.support.arb_shader_objects;
- gl_support_shading_language_100 = vid.support.arb_shading_language_100;
- gl_support_vertex_shader = vid.support.arb_vertex_shader;
- gl_support_fragment_shader = vid.support.arb_fragment_shader;
- gl_support_arb_vertex_buffer_object = vid.support.arb_vertex_buffer_object;
- gl_support_ext_framebuffer_object = vid.support.ext_framebuffer_object;
- gl_support_texture_compression = vid.support.arb_texture_compression;
- gl_support_arb_occlusion_query = vid.support.arb_occlusion_query;
- gl_support_amd_texture_texture4 = vid.support.amd_texture_texture4;
- gl_support_arb_texture_gather = vid.support.arb_texture_gather;
-
// VorteX: set other info (maybe place them in VID_InitMode?)
Cvar_SetQuick(&gl_info_vendor, gl_vendor);
Cvar_SetQuick(&gl_info_renderer, gl_renderer);