Tutorial01 fails (OpenGLContext callback error)
Brought to you by:
mcfletch
I am trying to get the first tutorial program to work, but it is not running correctly.
My program:
from OpenGLContext import testingcontext BaseContext = testingcontext.getInteractive() from OpenGL.GL import * from OpenGL.arrays import vbo from OpenGLContext.arrays import * from OpenGL.GL import shaders class TestContext( BaseContext ): """Creates a simple vertex shader...""" def OnInit(self): VERTEX_SHADER = shaders.compileShader(""" #version 130 void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } """, GL_VERTEX_SHADER) FRAGMENT_SHADER = shaders.compileShader(""" #version 130 void main() { gl_FragColor = vec4(0, 1, 0, 1); }""", GL_FRAGMENT_SHADER) self.shader = shaders.compileProgram(VERTEX_SHADER, FRAGMENT_SHADER) self.vbo = vbo.VBO( array( [ [ 0, 1, 0 ], [ -1,-1, 0 ], [ 1,-1, 0 ], [ 2,-1, 0 ], [ 4,-1, 0 ], [ 4, 1, 0 ], [ 2,-1, 0 ], [ 4, 1, 0 ], [ 2, 1, 0 ], ],'f') ) def render(self, mode): shaders.glUseProgram(self.shader) try: self.vbo.bind() try: glEnableClientState(GL_VERTEX_ARRAY) glVertexPointerf(self.vbo) glDrawArrays(GL_TRIANGLES, 0, 9) finally: self.vbo.unbind() glDisableClientState(GL_VERTERX_ARRAY) finally: shaders.glUseProgram(0) if __name__ == "__main__": TestContext.ContextMainLoop()
This is the error I am getting if I run the program. The error repeats if I move my mouse on top of the small window that appears, so the app is alive, but not really functional. The window shows what was behind it when the app started, so no real picture.
Traceback (most recent call last): File "_ctypes/callbacks.c", line 314, in 'calling callback function' File "/usr/lib/python2.7/site-packages/OpenGLContext/events/glutevents.py", line 33, in glutOnMouseMove self.triggerPick() File "/usr/lib/python2.7/site-packages/OpenGLContext/context.py", line 590, in triggerPick self.OnDraw() File "/usr/lib/python2.7/site-packages/OpenGLContext/context.py", line 515, in OnDraw visibleChange = self.renderPasses( self ) File "/usr/lib/python2.7/site-packages/OpenGLContext/passes/renderpass.py", line 866, in __call__ return FLAT( context ) File "/usr/lib/python2.7/site-packages/OpenGLContext/passes/flatcompat.py", line 298, in __call__ self.setViewPlatform( vp ) File "/usr/lib/python2.7/site-packages/OpenGLContext/passes/flatcompat.py", line 334, in setViewPlatform self.projection = vp.viewMatrix().astype('f') File "/usr/lib/python2.7/site-packages/OpenGLContext/move/viewplatform.py", line 158, in viewMatrix inverse=inverse, File "tmatrixaccel.pyx", line 55, in vrml_accelerate.tmatrixaccel.perspectiveMatrix (src/tmatrixaccel.c:1990) TypeError: perspectiveMatrix() got an unexpected keyword argument 'inverse'
My versions according to pip (latest as of 8.11.13):
Python 2.7.5 (default, Oct 8 2013, 12:19:40) [GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2 PyOpenGL - Standard OpenGL bindings for Python INSTALLED: 3.1.0a3 (latest) OpenGLContext - Demonstration and testing contexts for PyOpenGL/OpenGL-ctypes INSTALLED: 2.2.0a3 (latest) PyOpenGL-accelerate - Acceleration code for PyOpenGL INSTALLED: 3.1.0a3 (latest) OpenGLContext-full - Installs all of OpenGLContext with optional dependencies INSTALLED: 2.1.0a9 (latest) numpy - NumPy: array processing for numbers, strings, records, and objects. INSTALLED: 1.8.0 (latest)
Actually this is all that is required to get the error is this: