[ pyopengl-Bugs-3534110 ] hasGLExtension fail wrt circular import

SourceForge.net <[email protected]> Sun, 10 Jun 2012 03:02:20 -0700
Newsgroups gmane.comp.python.opengl.devel
Message-ID <[email protected]>
Bugs item #3534110, was opened at 2012-06-10 03:02
Message generated for change (Tracker Item Submitted) made by lxnt
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=3534110&group_id=5988

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: GL
Group: v3.0.0
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alexander Sabourenkov (lxnt)
Assigned to: Mike C. Fletcher (mcfletch)
Summary: hasGLExtension fail wrt circular import

Initial Comment:
Given a 3.0+ forward-compatible context, that is, with glGetString barking at GL_EXTENSIONS, "from OpenGL.GL import *" may fail if one of OpenGL.GL.VERSION.GL_* submodules with version below 3.0  calls hasGLExtension() due to the fact that until "from OpenGL.GL.VERSION.GL_3_0 import *" line is executed in OpenGL/GL/__init__.py, the line "from OpenGL.GL import GL_NUM_EXTENSIONS, glGetStringi, glGetIntegerv" is guaranteed to throw an ImportError.

Suggested solution:

replace the aforementioned import statement in the hasExtension() function with the following two lines:

                from OpenGL.GL.VERSION.GL_3_0 import GL_NUM_EXTENSIONS, glGetStringi
                from OpenGL.GL import glGetIntegerv

Works for me.

Attached patch: the above fix plus a couple of nits to make it all work under Python 3.2



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=3534110&group_id=5988

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net