Thread: [PyOpenGL-Devel] OpenGL 3.2 core profile
Brought to you by:
mcfletch
From: Gregor T. <gre...@gm...> - 2012-01-08 21:00:08
|
Hi, first thanks to Mike Fletcher for creating this wonderful package! I want to make use of the new OpenGL 3.2 core profile implementation on OS X 10.7 Lion. Now I experience some problems with PyOpenGL 3.0.2a, e.g. when I want to use glGenVertexArrays. I could track some of the problems to the function 'hasGLExtension' in OpenGL/extensions.py, here the problematic lines: try: AVAILABLE_GL_EXTENSIONS[:] = glGetString( GL_EXTENSIONS ).split() except error.GLError, err: # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS ) from OpenGL.GL import GL_NUM_EXTENSIONS, glGetStringi, glGetIntegerv count = glGetIntegerv( GL_NUM_EXTENSIONS ) for i in range( count ): AVAILABLE_GL_EXTENSIONS.append( glGetStringi( GL_EXTENSIONS, i ) ) result = specifier in AVAILABLE_GL_EXTENSIONS 1) glGetString(GL_EXTENSIONS) returns NULL, split() then throws an AttributeError. I observed (with GL Profiler) that there is no error check (call of GetError after GetString), therefore the next GL function call fails with a false error. 2) later, GetStringi( GL_EXTENSIONS, i) produces an OpenGL.arrays.arraydatatype.GLubyteArray instead of a bytes string, which gives always a False result in the last line. To fix this I duplicated in OpenGL/glget.py the code for glGetString accordingly for glGetStringi, and changed the import statement above to use this definition. 3) For glGenVertexArrays PyOpenGL expects that the extension GL_ARB_vertex_array_object is available. However, this extension is not present since glGenVertexArrays is part of OpenGL 3.0 (and 3.2 core profile). Here I am stuck, I don't know how to fix this (and for other related GL functions) Please, I need help to proceed with these problems. Gregor |
From: Mike C. F. <mcf...@vr...> - 2012-01-09 14:35:15
|
On 12-01-08 03:59 PM, Gregor Thalhammer wrote: > Hi, > > first thanks to Mike Fletcher for creating this wonderful package! > I want to make use of the new OpenGL 3.2 core profile implementation > on OS X 10.7 Lion. Now I experience some problems with PyOpenGL > 3.0.2a, e.g. when I want to use glGenVertexArrays. > > I could track some of the problems to the function 'hasGLExtension' in > OpenGL/extensions.py, here the problematic lines: > > try: > AVAILABLE_GL_EXTENSIONS[:] = glGetString( > GL_EXTENSIONS ).split() > except error.GLError, err: > # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS ) > from OpenGL.GL import GL_NUM_EXTENSIONS, glGetStringi, > glGetIntegerv > count = glGetIntegerv( GL_NUM_EXTENSIONS ) > for i in range( count ): > AVAILABLE_GL_EXTENSIONS.append( > glGetStringi( GL_EXTENSIONS, i ) > ) > result = specifier in AVAILABLE_GL_EXTENSIONS > > 1) glGetString(GL_EXTENSIONS) returns NULL, split() then throws an > AttributeError. > I observed (with GL Profiler) that there is no error check (call of > GetError after GetString), therefore the next GL function call fails > with a false error. This is fixed in bzr head. > > 2) later, GetStringi( GL_EXTENSIONS, i) produces an > OpenGL.arrays.arraydatatype.GLubyteArray instead of a bytes string, > which gives always a False result in the last line. > To fix this I duplicated in OpenGL/glget.py the code for glGetString > accordingly for glGetStringi, and changed the import statement above > to use this definition. Hrm, that one I haven't seen, nor do I see it when I create a 3.2 forward compatible context on Linux (Ubuntu 11.10). Are you using OpenGL_accelerate? (It has a slightly different implementation for Array data-types). > > 3) For glGenVertexArrays PyOpenGL expects that the > extension GL_ARB_vertex_array_object is available. However, this > extension is not present since glGenVertexArrays is part of OpenGL 3.0 > (and 3.2 core profile). Here I am stuck, I don't know how to fix this > (and for other related GL functions) This is fixed in bzr head of PyOpenGL, with an explicit mapping of version: implied-available-modules. The later OpenGL specs do an "include" of extensions rather than writing new versions of the entry points, but the latest release of PyOpenGL assumed that the implementation would still declare the extension available. > > Please, I need help to proceed with these problems. > > Gregor I've just done a very fast release of 3.0.2a2 (i.e. bzr head is now a "release"). I would expect there will be some teething problems with it, as I haven't had a chance to do a proper release (e.g. there's no OpenGL_accelerate compiled for it), but it may help you (and other OS-Xers) move forward. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Gregor T. <gre...@gm...> - 2012-01-09 16:51:21
|
Dear Mike, thanks for this great response! It seems all the mentioned problems I had with PyOpenGL are solved with the latest release. Now I just need to make my program work properly... Am 9.1.2012 um 15:19 schrieb Mike C. Fletcher: > On 12-01-08 03:59 PM, Gregor Thalhammer wrote: >> Hi, >> >> first thanks to Mike Fletcher for creating this wonderful package! >> I want to make use of the new OpenGL 3.2 core profile implementation >> on OS X 10.7 Lion. Now I experience some problems with PyOpenGL >> 3.0.2a, e.g. when I want to use glGenVertexArrays. >> >> I could track some of the problems to the function 'hasGLExtension' in >> OpenGL/extensions.py, here the problematic lines: >> >> try: >> AVAILABLE_GL_EXTENSIONS[:] = glGetString( >> GL_EXTENSIONS ).split() >> except error.GLError, err: >> # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS ) >> from OpenGL.GL import GL_NUM_EXTENSIONS, glGetStringi, >> glGetIntegerv >> count = glGetIntegerv( GL_NUM_EXTENSIONS ) >> for i in range( count ): >> AVAILABLE_GL_EXTENSIONS.append( >> glGetStringi( GL_EXTENSIONS, i ) >> ) >> result = specifier in AVAILABLE_GL_EXTENSIONS >> >> 1) glGetString(GL_EXTENSIONS) returns NULL, split() then throws an >> AttributeError. >> I observed (with GL Profiler) that there is no error check (call of >> GetError after GetString), therefore the next GL function call fails >> with a false error. > This is fixed in bzr head. >> >> 2) later, GetStringi( GL_EXTENSIONS, i) produces an >> OpenGL.arrays.arraydatatype.GLubyteArray instead of a bytes string, >> which gives always a False result in the last line. >> To fix this I duplicated in OpenGL/glget.py the code for glGetString >> accordingly for glGetStringi, and changed the import statement above >> to use this definition. > Hrm, that one I haven't seen, nor do I see it when I create a 3.2 > forward compatible context on Linux (Ubuntu 11.10). Are you using > OpenGL_accelerate? (It has a slightly different implementation for > Array data-types). With the latest release 3.0.2a this problem is gone. Just to mention: previously with 3.0.2a1 and OpenGL_accelerate I observed strange errors and segfaults. I didn't dig into this further and deinstalled OpenGL_accelerate. >> >> 3) For glGenVertexArrays PyOpenGL expects that the >> extension GL_ARB_vertex_array_object is available. However, this >> extension is not present since glGenVertexArrays is part of OpenGL 3.0 >> (and 3.2 core profile). Here I am stuck, I don't know how to fix this >> (and for other related GL functions) > This is fixed in bzr head of PyOpenGL, with an explicit mapping of > version: implied-available-modules. The later OpenGL specs do an > "include" of extensions rather than writing new versions of the entry > points, but the latest release of PyOpenGL assumed that the > implementation would still declare the extension available. >> >> Please, I need help to proceed with these problems. >> >> Gregor > I've just done a very fast release of 3.0.2a2 (i.e. bzr head is now a > "release"). I would expect there will be some teething problems with > it, as I haven't had a chance to do a proper release (e.g. there's no > OpenGL_accelerate compiled for it), but it may help you (and other > OS-Xers) move forward. > > HTH, > Mike > Thanks for your fantastic work, this helped me a lot! Gregor |
From: Mike C. F. <mcf...@vr...> - 2012-01-09 17:49:40
|
On 12-01-09 11:51 AM, Gregor Thalhammer wrote: > Dear Mike, > > thanks for this great response! It seems all the mentioned problems I had with PyOpenGL are solved with the latest release. Now I just need to make my program work properly... That's often the harder part... > With the latest release 3.0.2a this problem is gone. > Just to mention: previously with 3.0.2a1 and OpenGL_accelerate I observed strange errors and segfaults. I didn't dig into this further and deinstalled OpenGL_accelerate. I'd be surprised if the problem was with OpenGL_accelerate; I use that *always* (since I write it), it would be more likely to be OpenGL_accelerate *missing* that would cause a problem. Anyway, good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |