[PyOpenGL-Users] Attribute error using PyOpenGL and PyOpenCL
Brought to you by:
mcfletch
From: Walter W. <hom...@gm...> - 2014-09-24 11:40:23
|
Hello, I came across a problem and hope that you can help me, since I could not find a solution crawling the net. I was trying to run some examples to visualize OpenCL calculations using OpenGL with shared buffers using Python 3.3 PyOpenGL 3.1.0 PyOpenGL-accelarate 3.1.0 pyopencl 2014.1 The examples are similar, one that might serve as example is https://gitorious.org/openclgltest/openclgltest Trying to run this throws the error: Traceback (most recent call last): File ".\testpyopengl.py", line 234, in <module> mytest = test() File ".\testpyopengl.py", line 91, in __init__ self.loadclData() File ".\testpyopengl.py", line 205, in loadclData self.arr_cl = cl.GLBuffer(self.ctx, mf.READ_WRITE, int(self.arrvbo.buffers[0])) File "vbo.pyx", line 177, in OpenGL_accelerate.vbo.VBO.__ getattr__ (D:\Build\PyOpenGL\pyopengl-bzr\OpenGL_accelerate\src\vbo.c:2757) AttributeError: 'numpy.ndarray' object has no attribute 'buffers' Here are two things that might be related to the issue: 1.) PyOpenGL 3.1.0b3; Py_buffer on Python3 unsupported https://sourceforge.net/p/pyopengl/mailman/message/32385909/ 2.) This post that mentions that Python 3 might be the problem. Is that the case? http://stackoverflow.com/questions/21821045/numpy-getbuffer-causes-attributeerror-module-object-has-no-attribute-getbuff I found that another example https://github.com/enjalot/adventures_in_opencl/blob/master/python/part2/part2.py was trying to fix this like try: self.pos_cl = cl.GLBuffer(self.ctx, mf.READ_WRITE, int(self.pos_vbo.buffer)) self.col_cl = cl.GLBuffer(self.ctx, mf.READ_WRITE, int(self.col_vbo.buffer)) except AttributeError: self.pos_cl = cl.GLBuffer(self.ctx, mf.READ_WRITE, int(self.pos_vbo.buffers[0])) self.col_cl = cl.GLBuffer(self.ctx, mf.READ_WRITE, int(self.col_vbo.buffers[0])) But changing the example above like this results in Traceback (most recent call last): File ".\python-3.3.3.amd64\lib\site-packages\OpenGL\GLUT\special.py", line 130, in safeCall return function( *args, **named ) File ".\testpyopengl.py", line 182, in draw gl.glVertexPointer(4, gl.GL_FLOAT, 0, self.arrvbo) File "latebind.pyx", line 32, in OpenGL_accelerate.latebind.LateBind.__call__ (D:\Build\PyOpenGL\pyopengl-bzr\OpenGL_accelerate\src\latebind.c:992) File "wrapper.pyx", line 314, in OpenGL_accelerate.wrapper.Wrapper.__call__ (D:\Build\PyOpenGL\pyopengl-bzr\OpenGL_accelerate\src\wrapper.c:6508) File "wrapper.pyx", line 311, in OpenGL_accelerate.wrapper.Wrapper.__call__ (D:\Build\PyOpenGL\pyopengl-bzr\OpenGL_accelerate\src\wrapper.c:6442) File ".\python-3.3.3.amd64\lib\site-packages\OpenGL\platform\baseplatform.py", line 402, in __call__ return self( *args, **named ) ctypes.ArgumentError: ("argument 4: <class 'TypeError'>: wrong type", (4, GL_FLOAT, 0, <OpenGL_accelerate.vbo.VBO object at 0x0000000004752A60>)) GLUT Display callback <bound method test.draw of <__main__.test object at 0x0000000003A959B0>> with (),{} failed: returning None ("argument 4: <class 'TypeError'>: wrong type", (4, GL_FLOAT, 0, <OpenGL_accelerate.vbo.VBO object at 0x0000000004752A60>)) Well, that for now. I hope you have some ideas on how to fix this. Kind regards, Joe |