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,8 +977,7 @@ 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_MTexCoord2fFunc = (void *) wglGetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = (void *) wglGetProcAddress("glActiveTextureARB"); GL_SelectTextureFunc = (void *) wglGetProcAddress("glActiveTextureARB");
@ -1021,10 +989,11 @@ void GL_CheckExtensions (void)
gl_mtexable = true; gl_mtexable = true;
} }
else else
Con_Warning ("multitexture not supported (wglGetProcAddress failed)\n"); {
Con_Warning ("Couldn't link to multitexture functions\n");
} }
else }
if (strstr(gl_extensions, "GL_SGIS_multitexture")) else if (strstr(gl_extensions, "GL_SGIS_multitexture"))
{ {
GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMTexCoord2fSGIS"); GL_MTexCoord2fFunc = (void *) wglGetProcAddress("glMTexCoord2fSGIS");
GL_SelectTextureFunc = (void *) wglGetProcAddress("glSelectTextureSGIS"); GL_SelectTextureFunc = (void *) wglGetProcAddress("glSelectTextureSGIS");
@ -1036,49 +1005,54 @@ void GL_CheckExtensions (void)
gl_mtexable = true; gl_mtexable = true;
} }
else else
Con_Warning ("multitexture not supported (wglGetProcAddress failed)\n"); {
Con_Warning ("Couldn't link to multitexture functions\n");
}
} }
else else
{
Con_Warning ("multitexture not supported (extension not found)\n"); 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 else if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
{ {
Con_Printf("FOUND: ARB_texture_env_combine\n"); Con_Printf("FOUND: ARB_texture_env_combine\n");
gl_texture_env_combine = true; gl_texture_env_combine = true;
} }
else else if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{ {
Con_Printf("FOUND: EXT_texture_env_combine\n"); Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true; gl_texture_env_combine = true;
} }
else else
{
Con_Warning ("texture_env_combine not supported\n"); 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 else if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
{ {
Con_Printf("FOUND: ARB_texture_env_add\n"); Con_Printf("FOUND: ARB_texture_env_add\n");
gl_texture_env_add = true; gl_texture_env_add = true;
} }
else else if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{ {
Con_Printf("FOUND: EXT_texture_env_add\n"); Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true; gl_texture_env_add = true;
} }
else else
{
Con_Warning ("texture_env_add not supported\n"); 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,13 +574,10 @@ 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) GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
SDL_GL_GetProcAddress("glMultiTexCoord2fARB"); GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress("glActiveTextureARB");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc) if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{ {
Con_Printf("FOUND: ARB_multitexture\n"); Con_Printf("FOUND: ARB_multitexture\n");
@ -620,15 +586,14 @@ void GL_CheckExtensions (void)
gl_mtexable = true; gl_mtexable = true;
} }
else else
Con_Warning ("multitexture not supported (SDL_GL_GetProcAddress failed)\n");
}
else
if (strstr(gl_extensions, "GL_SGIS_multitexture"))
{ {
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) Con_Warning ("Couldn't link to multitexture functions\n");
SDL_GL_GetProcAddress("glMTexCoord2fSGIS"); }
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) }
SDL_GL_GetProcAddress("glSelectTextureSGIS"); else if (strstr(gl_extensions, "GL_SGIS_multitexture"))
{
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) SDL_GL_GetProcAddress("glMTexCoord2fSGIS");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glSelectTextureSGIS");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc) if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{ {
Con_Printf("FOUND: SGIS_multitexture\n"); Con_Printf("FOUND: SGIS_multitexture\n");
@ -637,49 +602,54 @@ void GL_CheckExtensions (void)
gl_mtexable = true; gl_mtexable = true;
} }
else else
Con_Warning ("multitexture not supported (SDL_GL_GetProcAddress failed)\n"); {
Con_Warning ("Couldn't link to multitexture functions\n");
}
} }
else else
{
Con_Warning ("multitexture not supported (extension not found)\n"); 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 else if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
if (strstr(gl_extensions, "GL_ARB_texture_env_combine"))
{ {
Con_Printf("FOUND: ARB_texture_env_combine\n"); Con_Printf("FOUND: ARB_texture_env_combine\n");
gl_texture_env_combine = true; gl_texture_env_combine = true;
} }
else else if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
if (strstr(gl_extensions, "GL_EXT_texture_env_combine"))
{ {
Con_Printf("FOUND: EXT_texture_env_combine\n"); Con_Printf("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true; gl_texture_env_combine = true;
} }
else else
{
Con_Warning ("texture_env_combine not supported\n"); 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 else if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
if (strstr(gl_extensions, "GL_ARB_texture_env_add"))
{ {
Con_Printf("FOUND: ARB_texture_env_add\n"); Con_Printf("FOUND: ARB_texture_env_add\n");
gl_texture_env_add = true; gl_texture_env_add = true;
} }
else else if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
if (strstr(gl_extensions, "GL_EXT_texture_env_add"))
{ {
Con_Printf("FOUND: EXT_texture_env_add\n"); Con_Printf("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true; gl_texture_env_add = true;
} }
else else
{
Con_Warning ("texture_env_add not supported\n"); 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");
}
} }
/* /*