0

I'm a beginner in OpenGL/OpenCL. I'm trying to execute code from this example, but there is an error:

Traceback (most recent call last):
File "/home/anka-rybalko/workspace/bla/openGL.py", line 99, in initializeGL
self.initialize_buffers()
File "/home/anka-rybalko/workspace/bla/openGL.py", line 61, in initialize_buffers
self.ctx, self.queue = clinit()
File "/home/anka-rybalko/workspace/bla/openGL.py", line 37, in clinit
+ get_gl_sharing_context_properties())
File "/usr/lib64/python2.7/site-packages/pyopencl-2014.1-py2.7-linux-x86_64.egg/pyopencl/tools.py", line 422, in get_gl_sharing_context_properties
from OpenGL import platform as gl_platform, GLX, WGL
File "/usr/lib/python2.7/site-packages/OpenGL/WGL/__init__.py", line 1, in <module>
from OpenGL.raw.WGL.VERSION.WGL_1_0 import *
File "/usr/lib/python2.7/site-packages/OpenGL/raw/WGL/VERSION/WGL_1_0.py", line 48, in <module>
@_p.types(_cs.c_int,_cs.HDC,ctypes.POINTER(_cs.PIXELFORMATDESCRIPTOR))
File "/usr/lib/python2.7/site-packages/OpenGL/raw/WGL/VERSION/WGL_1_0.py", line 13, in _f
return _p.createFunction( function,_p.PLATFORM.WGL,'WGL_VERSION_WGL_1_0',error_checker=_errors._error_checker)
AttributeError: 'GLXPlatform' object has no attribute 'WGL'

As I understand, WGL is an API for Windows OS and not for Linux. Should I somehow specify my platform before? Or how can I fix this?

Thanks in advance!

prybalko
  • 115
  • 1
  • 7
  • Please specify which peace of code is causing the trouble and if possible post a minimal example where you think the code SHOULD run. If you could provide that, I'd be happy to give it a try. –  Jul 02 '14 at 09:19
  • @andi As I understand, the error appears right before calling "resizeGL" function. Before that everything works smoothly. – prybalko Jul 03 '14 at 09:26
  • I was asking if you could post the code causing the problem, so I can reproduce the error. –  Jul 03 '14 at 11:08
  • @andi Oh, sorry. The code is an example from the bottom of [this page](http://cyrille.rossant.net/a-tutorial-on-openglopencl-interoperability-in-python/) – prybalko Jul 03 '14 at 12:37
  • Ok, I run it on a Windows 8 machine. I get slightly different error. I will look into it. –  Jul 03 '14 at 14:56

1 Answers1

0

The code you are using (PyOpenGL 2014.1) is importing two platform-specific modules (WGL and GLX). PyOpenGL should have raised that error as an ImportError (rather than the AttributeError), but it still would have failed.

PyOpenCL has, in the meantime, worked around the issue in their github repository. If you have git installed (and pip) then this should get you a new version (note: not set up for OpenCL development here, so can't actually test this):

pip install git+https://github.com/pyopencl/pyopencl#egg=pyopencl
vrplumber
  • 166
  • 1
  • 2