glGenVertexArrays missing with Python 3
Tom Goddard <[email protected]> Tue, 30 Apr 2013 23:36:53 -0700
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <[email protected]> |
I'm using an OpenGL 3.2 context (core profile) on Mac 10.8.3 and I find that bool(OpenGL.GL.glGenVertexArrays) is False when I use Python 3.3.1 and True when I use Python 2.7.4. Since glGenVertexArrays is core in OpenGL 3.0 there is something wrong when using PyOpenGL with Python 3.3.1. I observe this using PyOpenGL bzr head source code from April 29, 2013 and am using PyQt4 and Qt 5.0.2. Some digging reveals that the bug is in PyOpenGL file OpenGL/extensions.py and is caused by the AVAILABLE_GL_EXTENSIONS variable in that file containing a list that includes some extension names as strings and some as Python 3 bytearrays. The code that checks if glGenVertexArrays is available looks to see if the byte array b"glGenVertexArrays" is in AVAILABLE_GL_EXTENSIONS but it does not find it. The string "glGenVertexArrays" is in that list but bytearrays are never equal to strings in Python 3. This bug results in all the extensions listed in VERSION_EXTENSIONS in extensions.py not being found. A change in one line fixes the bug and is provided in the attached patch. I hope this can be part of the next PyOpenGL release. With this patch PyOpenGL is working nicely with a Mac OpenGL 3.2 core profile context and Python 3.3.1 using GLSL version 150 shaders, vertex buffers and vertex array objects showing surfaces, meshes, and textures in a molecular visualization program I am developing (next generation of UCSF Chimera). Tom Goddard ------------------------------------------------------------------------------ Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with <2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-users
pyopengl_extensions.patch
(application/octet-stream, 803 B)
*** OpenGL/extensions.py~ Mon Apr 29 17:01:34 2013
--- OpenGL/extensions.py Tue Apr 30 14:33:28 2013
***************
*** 139,145 ****
if v <= check:
for v_ext in v_exts:
if v_ext not in AVAILABLE_GL_EXTENSIONS:
! AVAILABLE_GL_EXTENSIONS.append( v_ext )
else:
break
result = specifier in AVAILABLE_GL_EXTENSIONS
--- 139,145 ----
if v <= check:
for v_ext in v_exts:
if v_ext not in AVAILABLE_GL_EXTENSIONS:
! AVAILABLE_GL_EXTENSIONS.append( as_8_bit(v_ext) )
else:
break
result = specifier in AVAILABLE_GL_EXTENSIONS