Bug 2636621 - GLEW_VERSION_2_1 and GLEW_VERSION_3_0 == 0?

View: New views
5 Messages — Rating Filter:   Alert me  

Bug 2636621 - GLEW_VERSION_2_1 and GLEW_VERSION_3_0 == 0?

by Nigel Stewart-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I have marked a bunch of bugs "pending" over on the
Sourceforge tracker, leaving only one tracked bug:
GLEW_VERSION_2_1 and GLEW_VERSION_3_0 for OpenGL 3.0
contexts

My proposed patch is attached, the lines are
128 characters wide (for good reasons I think),
but it ought to be more maintainable than what
is there currently.

- Nigel


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Index: auto/src/glew_init_gl.c
===================================================================
--- auto/src/glew_init_gl.c (revision 548)
+++ auto/src/glew_init_gl.c (working copy)
@@ -31,80 +31,36 @@
 GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
 {
   const GLubyte* s;
-  GLuint dot, major, minor;
+  GLuint dot;
+  GLint major, minor;
   /* query opengl version */
   s = glGetString(GL_VERSION);
   dot = _glewStrCLen(s, '.');
-  major = dot-1;
-  minor = dot+1;
-  if (dot == 0 || s[minor] == '\0')
+  if (dot == 0)
     return GLEW_ERROR_NO_GL_VERSION;
-  if (s[major] == '1' && s[minor] == '0')
+  
+  major = s[dot-1]-'0';
+  minor = s[dot+1]-'0';
+
+  if (minor < 0 || minor > 9)
+    minor = 0;
+  if (major<0 || major>9)
+    return GLEW_ERROR_NO_GL_VERSION;
+  
+
+  if (major == 1 && minor == 0)
   {
- return GLEW_ERROR_GL_VERSION_10_ONLY;
+    return GLEW_ERROR_GL_VERSION_10_ONLY;
   }
   else
   {
-    CONST_CAST(GLEW_VERSION_1_1) = GL_TRUE;
- if (s[major] >= '2')
- {
-      CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
-      CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
-      CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
-  CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
-  CONST_CAST(GLEW_VERSION_2_0) = GL_TRUE;
-  if (s[minor] >= '1')
-  {
-    CONST_CAST(GLEW_VERSION_2_1) = GL_TRUE;
-      }
- }
- else
- {
-  if (s[minor] >= '5')
-  {
- CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
-  }
-  if (s[minor] == '4')
-  {
- CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
-  }
-  if (s[minor] == '3')
-  {
- CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
-  }
-  if (s[minor] == '2')
-  {
- CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
- CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
-  }
-  if (s[minor] < '2')
-  {
- CONST_CAST(GLEW_VERSION_1_2) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
- CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
-  }
- }
+    CONST_CAST(GLEW_VERSION_3_0) =                                ( major >= 3               ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;    
+    CONST_CAST(GLEW_VERSION_2_0) = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2               ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_1_5) = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_1_4) = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_1_3) = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_1_2) = GLEW_VERSION_1_3 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
+    CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
   }
   /* initialize extensions */

   

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
glew-coders mailing list
glew-coders@...
https://lists.sourceforge.net/lists/listinfo/glew-coders

Re: OpenGL 3.1

by Nigel Stewart-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> My proposed patch is attached, the lines are
> 128 characters wide (for good reasons I think),
> but it ought to be more maintainable than what
> is there currently.

   Announced today: OpenGL 3.1

   Which suggests there will be another patch shortly
   after we're happy with this one.

- Nigel

http://www.khronos.org/news/press/releases/khronos-releases-streamlined-opengl-3.1-specification/

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
glew-coders mailing list
glew-coders@...
https://lists.sourceforge.net/lists/listinfo/glew-coders

Re: Bug 2636621 - GLEW_VERSION_2_1 and GLEW_VERSION_3_0 == 0?

by tom fogal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nigel Stewart <nstewart@...> writes:
[snip]
> GLEW_VERSION_2_1 and GLEW_VERSION_3_0 for OpenGL 3.0
> contexts
>
> My proposed patch is attached [. . .]

Seems okay from a look.  I tried it with my nvidia 180.29 driver
though, and it told me I didn't have OGL 3.0, despite GL_VERSION
reporting as much.  I dug deeper; the string parsing is fine.
The issue is in initializing the GL functions: GLEW can't find
`glClampColor'.

By the typesetting in the OpenGL 3.0 spec, glClampColor is an optional
component of the 3.0 spec.  See section 3.7, page 180 (look carefully
-- another part of the spec errantly leads one to section 3.8!).

I think 3.0 should be listed as `supported' on this and similar
drivers, despite missing one or more of the optional components.


I did not try with Mesa.

-tom

------------------------------------------------------------------------------
_______________________________________________
glew-coders mailing list
glew-coders@...
https://lists.sourceforge.net/lists/listinfo/glew-coders

Re: Bug 2636621 - GLEW_VERSION_2_1 and GLEW_VERSION_3_0 == 0?

by Nigel Stewart-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> My proposed patch is attached [. . .]
>
> Seems okay from a look.

Tom,

The change has gone in as Revision 549.
Thanks for looking at it.

I'll take at the Nvidia issues too...

- Nigel


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

------------------------------------------------------------------------------
_______________________________________________
glew-coders mailing list
glew-coders@...
https://lists.sourceforge.net/lists/listinfo/glew-coders

Re: Bug 2636621 - GLEW_VERSION_2_1 and GLEW_VERSION_3_0 == 0?

by Nigel Stewart-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I tried it with my nvidia 180.29 driver...
> By the typesetting in the OpenGL 3.0 spec, glClampColor is an optional
> component of the 3.0 spec...

        No problem with the 180.44 driver, my impression is
        that it was missing from previous driver versions,
        including the Nvidia-bundled glext.h

- Nigel


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

------------------------------------------------------------------------------
_______________________________________________
glew-coders mailing list
glew-coders@...
https://lists.sourceforge.net/lists/listinfo/glew-coders