Corbin Simpson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> - From 1f80772f964bd2253a2d569eea4d93fe7a1baa1f Mon Sep 17 00:00:00 2001
> From: Corbin Simpson <[EMAIL PROTECTED]>
> Date: Sat, 16 Aug 2008 08:22:53 -0700
> Subject: [PATCH] Fix GLSL detection
>  Look for extensions instead of OGL 2.0, this lets non-2.0 drivers do GLSL.
> 
> - ---
>  progs/util/shaderutil.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
> index 477209a..bd000a6 100644
> - --- a/progs/util/shaderutil.c
> +++ b/progs/util/shaderutil.c
> @@ -27,14 +27,12 @@ Init(void)
>  GLboolean
>  ShadersSupported(void)
>  {
> - -   const char *version;
> - -
> - -   version = (const char *) glGetString(GL_VERSION);
> - -   if (version[0] != '2' || version[1] != '.') {
> - -      printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
> - -      return GL_FALSE;
> +   if (glutExtensionSupported("GL_ARB_vertex_shader")
> +       && glutExtensionSupported("GL_ARB_fragment_shader")
> +       && glutExtensionSupported("GL_ARB_shader_objects")) {
> +      return GL_TRUE;
>     }
> - -   return GL_TRUE;
> +   return GL_FALSE;
>  }

Actually, that isn't exactly correct.  The demos that use the 
shaderutil.c code are based on the OpenGL 2.x API, not the ARB GLSL 
extensions.

The above might work for Mesa, but it could break with other OpenGL 
implementations.

If you want to re-spin that patch, you should keep the test for GL 
"2.x".  If that fails, check for the ARB extensions and print a warning 
message that the program might crash (because of unresolved symbols).

-Brian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to