4 // LordHavoc: these are only set in wgl
5 qboolean isG200 = false; // LordHavoc: the Matrox G200 can't do per pixel alpha, and it uses a D3D driver for GL... ugh...
6 qboolean isRagePro = false; // LordHavoc: the ATI Rage Pro has limitations with per pixel alpha (the color scaler does not apply to per pixel alpha images...), although not as bad as a G200.
8 // LordHavoc: GL_ARB_multitexture support
9 int gl_mtexable = false;
10 // LordHavoc: GL_ARB_texture_env_combine support
11 int gl_combine_extension = false;
12 // LordHavoc: GL_EXT_compiled_vertex_array support
13 int gl_supportslockarrays = false;
15 cvar_t vid_mode = {0, "vid_mode", "0"};
16 cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
17 cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
18 cvar_t gl_combine = {0, "gl_combine", "1"};
20 // GL_ARB_multitexture
21 void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
22 void (GLAPIENTRY *qglActiveTexture) (GLenum);
23 void (GLAPIENTRY *qglClientActiveTexture) (GLenum);
25 // GL_EXT_compiled_vertex_array
26 void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
27 void (GLAPIENTRY *qglUnlockArraysEXT) (void);
34 gl_extensionfunctionlist_t;
39 gl_extensionfunctionlist_t *funcs;
45 static gl_extensionfunctionlist_t multitexturefuncs[] =
47 {"glMultiTexCoord2fARB", (void **) &qglMultiTexCoord2f},
48 {"glActiveTextureARB", (void **) &qglActiveTexture},
49 {"glClientActiveTextureARB", (void **) &qglClientActiveTexture},
53 static gl_extensionfunctionlist_t compiledvertexarrayfuncs[] =
55 {"glLockArraysEXT", (void **) &qglLockArraysEXT},
56 {"glUnlockArraysEXT", (void **) &qglUnlockArraysEXT},
60 static gl_extensioninfo_t gl_extensioninfo[] =
62 {"GL_ARB_multitexture", multitexturefuncs, &gl_mtexable, "-nomtex"},
63 {"GL_ARB_texture_env_combine", NULL, &gl_combine_extension, "-nocombine"},
64 {"GL_EXT_compiled_vertex_array", compiledvertexarrayfuncs, &gl_supportslockarrays, "-nocva"},
65 {NULL, NULL, NULL, NULL}
72 void VID_CheckExtensions(void)
77 gl_extensioninfo_t *info;
78 gl_extensionfunctionlist_t *func;
79 // multitexturefuncs[0].funcvariable = (void **)&qglMultiTexCoord2f;
80 Con_Printf("Checking OpenGL extensions...\n");
82 if ((prjobj = dlopen(NULL, RTLD_LAZY)) == NULL)
84 Con_Printf("Unable to open symbol list for main program.\n");
88 for (info = gl_extensioninfo;info && info->name;info++)
90 *info->enablevariable = false;
91 for (func = info->funcs;func && func->name;func++)
92 *func->funcvariable = NULL;
93 Con_Printf("checking for %s... ", info->name);
94 if (info->disableparm && COM_CheckParm(info->disableparm))
96 Con_Printf("disabled by commandline\n");
99 if (strstr(gl_extensions, info->name))
101 for (func = info->funcs;func && func->name != NULL;func++)
104 if (!(*func->funcvariable = (void *) wglGetProcAddress(func->name)))
106 if (!(*func->funcvariable = (void *) dlsym(prjobj, func->name)))
109 Con_Printf("missing function \"%s\"!\n", func->name);
113 Con_Printf("enabled\n");
114 *info->enablevariable = true;
118 Con_Printf("not detected\n");
125 void Force_CenterView_f (void)
127 cl.viewangles[PITCH] = 0;
130 void VID_InitCvars(void)
132 Cvar_RegisterVariable(&vid_mode);
133 Cvar_RegisterVariable(&vid_mouse);
134 Cvar_RegisterVariable(&vid_fullscreen);
135 Cvar_RegisterVariable(&gl_combine);
136 Cmd_AddCommand("force_centerview", Force_CenterView_f);