gl_vidnt.c, gl_vidsdl.c: Reformatted GL_CheckExtensions for better readability,

removed the old unused CheckArrayExtensions.


git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@348 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-12-26 22:10:44 +00:00
parent 6fe1dbab48
commit 7fddf9abdc
2 changed files with 135 additions and 177 deletions

View file

@ -965,37 +965,6 @@ void GL_Info_f (void)
Con_Printf ("WGL_EXTENSIONS: %s\n", wgl_extensions_nice); Con_Printf ("WGL_EXTENSIONS: %s\n", wgl_extensions_nice);
} }
/*
===============
CheckArrayExtensions
===============
*/
#if 0 /* unused */
void CheckArrayExtensions (void)
{
const char *tmp;
tmp = (const char *)glGetString(GL_EXTENSIONS);
while (*tmp)
{
if (strncmp(tmp, "GL_EXT_vertex_array", sizeof("GL_EXT_vertex_array") -1) == 0)
{
if (((glArrayElementEXT = wglGetProcAddress("glArrayElementEXT")) == NULL) ||
((glColorPointerEXT = wglGetProcAddress("glColorPointerEXT")) == NULL) ||
((glTexCoordPointerEXT = wglGetProcAddress("glTexCoordPointerEXT")) == NULL) ||
((glVertexPointerEXT = wglGetProcAddress("glVertexPointerEXT")) == NULL) )
{
Sys_Error ("GetProcAddress for vertex extension failed");
}
return;
}
tmp++;
}
Sys_Error ("Vertex array extension not present");
}
#endif /* #if 0 */
/* /*
=============== ===============
GL_CheckExtensions -- johnfitz GL_CheckExtensions -- johnfitz
@ -1008,77 +977,82 @@ void GL_CheckExtensions (void)
// //
if (COM_CheckParm("-nomtex")) if (COM_CheckParm("-nomtex"))
Con_Warning ("Mutitexture disabled at command line\n"); Con_Warning ("Mutitexture disabled at command line\n");
else else if (strstr(gl_extensions, "GL_ARB_multitexture"))
if (strstr(gl_extensions, "GL_ARB_multitexture")) {
GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = (void *) wglGetProcAddress("glActiveTextureARB");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{ {
GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMultiTexCoord2fARB"); Con_Printf("FOUND: ARB_multitexture\n");
GL_SelectTextureFunc = (void *) wglGetProcAddress("glActiveTextureARB"); TEXTURE0 = GL_TEXTURE0_ARB;
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc) TEXTURE1 = GL_TEXTURE1_ARB;
{ gl_mtexable = true;
Con_Printf("FOUND: ARB_multitexture\n");
TEXTURE0 = GL_TEXTURE0_ARB;
TEXTURE1 = GL_TEXTURE1_ARB;
gl_mtexable = true;
}
else
Con_Warning ("multitexture not supported (wglGetProcAddress failed)\n");
} }
else else
if (strstr(gl_extensions, "GL_SGIS_multitexture")) {
{ Con_Warning ("Couldn't link to multitexture functions\n");
GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMTexCoord2fSGIS"); }
GL_SelectTextureFunc = (void *) wglGetProcAddress("glSelectTextureSGIS"); }
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc) else if (strstr(gl_extensions, "GL_SGIS_multitexture"))
{ {
Con_Printf("FOUND: SGIS_multitexture\n"); GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMTexCoord2fSGIS");
TEXTURE0 = TEXTURE0_SGIS; GL_SelectTextureFunc = (void *) wglGetProcAddress("glSelectTextureSGIS");
TEXTURE1 = TEXTURE1_SGIS; if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
gl_mtexable = true; {
} Con_Printf("FOUND: SGIS_multitexture\n");
else TEXTURE0 = TEXTURE0_SGIS;
Con_Warning ("multitexture not supported (wglGetProcAddress failed)\n"); TEXTURE1 = TEXTURE1_SGIS;
gl_mtexable = true;
}
else
{
Con_Warning ("Couldn't link to multitexture functions\n");
}
}
else
{
Con_Warning ("multitexture not supported (extension not found)\n");
}
}
else
Con_Warning ("multitexture not supported (extension not found)\n");
// //
// texture_env_combine // texture_env_combine
// //
if (COM_CheckParm("-nocombine")) if (COM_CheckParm("-nocombine"))
Con_Warning ("texture_env_combine disabled at command line\n"); Con_Warning ("texture_env_combine disabled at command line\n");
else if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
{
Con_Printf("FOUND: ARB_texture_env_combine\n");
gl_texture_env_combine = true;
}
else if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{
Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true;
}
else else
if (strstr(gl_extensions, "GL_ARB_texture_env_combine")) {
{ Con_Warning ("texture_env_combine not supported\n");
Con_Printf("FOUND: ARB_texture_env_combine\n"); }
gl_texture_env_combine = true;
}
else
if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{
Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true;
}
else
Con_Warning ("texture_env_combine not supported\n");
// //
// texture_env_add // texture_env_add
// //
if (COM_CheckParm("-noadd")) if (COM_CheckParm("-noadd"))
Con_Warning ("texture_env_add disabled at command line\n"); Con_Warning ("texture_env_add disabled at command line\n");
else if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
{
Con_Printf("FOUND: ARB_texture_env_add\n");
gl_texture_env_add = true;
}
else if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{
Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true;
}
else else
if (strstr(gl_extensions, "GL_ARB_texture_env_add")) {
{ Con_Warning ("texture_env_add not supported\n");
Con_Printf("FOUND: ARB_texture_env_add\n"); }
gl_texture_env_add = true;
}
else
if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{
Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true;
}
else
Con_Warning ("texture_env_add not supported\n");
// //
// swap control // swap control
@ -1101,10 +1075,14 @@ void GL_CheckExtensions (void)
} }
} }
else else
Con_Warning ("vertical sync not supported (wglGetProcAddress failed)\n"); {
Con_Warning ("Couldn't link to vertical sync functions\n");
}
} }
else else
{
Con_Warning ("vertical sync not supported (extension not found)\n"); Con_Warning ("vertical sync not supported (extension not found)\n");
}
// //
// anisotropic filtering // anisotropic filtering
@ -1130,13 +1108,17 @@ void GL_CheckExtensions (void)
gl_anisotropy_able = true; gl_anisotropy_able = true;
} }
else else
{
Con_Warning ("anisotropic filtering locked by driver. Current driver setting is %f\n", test1); Con_Warning ("anisotropic filtering locked by driver. Current driver setting is %f\n", test1);
}
//get max value either way, so the menu and stuff know it //get max value either way, so the menu and stuff know it
glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy); glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy);
} }
else else
{
Con_Warning ("texture_filter_anisotropic not supported\n"); Con_Warning ("texture_filter_anisotropic not supported\n");
}
} }
/* /*

View file

@ -560,37 +560,6 @@ void GL_Info_f (void)
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions_nice); Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions_nice);
} }
/*
===============
CheckArrayExtensions
===============
*/
#if 0 /* unused */
void CheckArrayExtensions (void)
{
const char *tmp;
tmp = (const char *)glGetString(GL_EXTENSIONS);
while (*tmp)
{
if (strncmp(tmp, "GL_EXT_vertex_array", sizeof("GL_EXT_vertex_array") -1) == 0)
{
if (((glArrayElementEXT = SDL_GL_GetProcAddress("glArrayElementEXT")) == NULL) ||
((glColorPointerEXT = SDL_GL_GetProcAddress("glColorPointerEXT")) == NULL) ||
((glTexCoordPointerEXT = SDL_GL_GetProcAddress("glTexCoordPointerEXT")) == NULL) ||
((glVertexPointerEXT = SDL_GL_GetProcAddress("glVertexPointerEXT")) == NULL) )
{
Sys_Error ("GetProcAddress for vertex extension failed");
}
return;
}
tmp++;
}
Sys_Error ("Vertex array extension not present");
}
#endif /* #if 0 */
/* /*
=============== ===============
GL_CheckExtensions -- johnfitz GL_CheckExtensions -- johnfitz
@ -605,81 +574,82 @@ void GL_CheckExtensions (void)
// //
if (COM_CheckParm("-nomtex")) if (COM_CheckParm("-nomtex"))
Con_Warning ("Mutitexture disabled at command line\n"); Con_Warning ("Mutitexture disabled at command line\n");
else else if (strstr(gl_extensions, "GL_ARB_multitexture"))
if (strstr(gl_extensions, "GL_ARB_multitexture")) {
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{ {
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) Con_Printf("FOUND: ARB_multitexture\n");
SDL_GL_GetProcAddress("glMultiTexCoord2fARB"); TEXTURE0 = GL_TEXTURE0_ARB;
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) TEXTURE1 = GL_TEXTURE1_ARB;
SDL_GL_GetProcAddress("glActiveTextureARB"); gl_mtexable = true;
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{
Con_Printf("FOUND: ARB_multitexture\n");
TEXTURE0 = GL_TEXTURE0_ARB;
TEXTURE1 = GL_TEXTURE1_ARB;
gl_mtexable = true;
}
else
Con_Warning ("multitexture not supported (SDL_GL_GetProcAddress failed)\n");
} }
else else
if (strstr(gl_extensions, "GL_SGIS_multitexture")) {
{ Con_Warning ("Couldn't link to multitexture functions\n");
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) }
SDL_GL_GetProcAddress("glMTexCoord2fSGIS"); }
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) else if (strstr(gl_extensions, "GL_SGIS_multitexture"))
SDL_GL_GetProcAddress("glSelectTextureSGIS"); {
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc) GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) SDL_GL_GetProcAddress("glMTexCoord2fSGIS");
{ GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glSelectTextureSGIS");
Con_Printf("FOUND: SGIS_multitexture\n"); if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
TEXTURE0 = TEXTURE0_SGIS; {
TEXTURE1 = TEXTURE1_SGIS; Con_Printf("FOUND: SGIS_multitexture\n");
gl_mtexable = true; TEXTURE0 = TEXTURE0_SGIS;
} TEXTURE1 = TEXTURE1_SGIS;
else gl_mtexable = true;
Con_Warning ("multitexture not supported (SDL_GL_GetProcAddress failed)\n"); }
else
{
Con_Warning ("Couldn't link to multitexture functions\n");
}
}
else
{
Con_Warning ("multitexture not supported (extension not found)\n");
}
}
else
Con_Warning ("multitexture not supported (extension not found)\n");
// //
// texture_env_combine // texture_env_combine
// //
if (COM_CheckParm("-nocombine")) if (COM_CheckParm("-nocombine"))
Con_Warning ("texture_env_combine disabled at command line\n"); Con_Warning ("texture_env_combine disabled at command line\n");
else if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
{
Con_Printf("FOUND: ARB_texture_env_combine\n");
gl_texture_env_combine = true;
}
else if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{
Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true;
}
else else
if (strstr(gl_extensions, "GL_ARB_texture_env_combine")) {
{ Con_Warning ("texture_env_combine not supported\n");
Con_Printf("FOUND: ARB_texture_env_combine\n"); }
gl_texture_env_combine = true;
}
else
if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{
Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true;
}
else
Con_Warning ("texture_env_combine not supported\n");
// //
// texture_env_add // texture_env_add
// //
if (COM_CheckParm("-noadd")) if (COM_CheckParm("-noadd"))
Con_Warning ("texture_env_add disabled at command line\n"); Con_Warning ("texture_env_add disabled at command line\n");
else if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
{
Con_Printf("FOUND: ARB_texture_env_add\n");
gl_texture_env_add = true;
}
else if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{
Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true;
}
else else
if (strstr(gl_extensions, "GL_ARB_texture_env_add")) {
{ Con_Warning ("texture_env_add not supported\n");
Con_Printf("FOUND: ARB_texture_env_add\n"); }
gl_texture_env_add = true;
}
else
if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{
Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true;
}
else
Con_Warning ("texture_env_add not supported\n");
// //
// swap control // swap control
@ -709,7 +679,9 @@ void GL_CheckExtensions (void)
} }
} }
else else
{
Con_Warning ("vertical sync not supported (extension not found)\n"); Con_Warning ("vertical sync not supported (extension not found)\n");
}
// //
// anisotropic filtering // anisotropic filtering
@ -735,13 +707,17 @@ void GL_CheckExtensions (void)
gl_anisotropy_able = true; gl_anisotropy_able = true;
} }
else else
{
Con_Warning ("anisotropic filtering locked by driver. Current driver setting is %f\n", test1); Con_Warning ("anisotropic filtering locked by driver. Current driver setting is %f\n", test1);
}
//get max value either way, so the menu and stuff know it //get max value either way, so the menu and stuff know it
glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy); glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy);
} }
else else
{
Con_Warning ("texture_filter_anisotropic not supported\n"); Con_Warning ("texture_filter_anisotropic not supported\n");
}
} }
/* /*