Stephen Newman <stephenharmonnew...@gmail.com> writes:

> To whom it may concern,
>
> I am finding myself unable to create a pyopencl context which can interface
> with OpenGL. Upon running the following code:
> from OpenGL import GLX
> import OpenGL.GL as gl
> import OpenGL
> import pyopencl as cl
> from pyopencl.tools import get_gl_sharing_context_properties
> platform = cl.get_platforms()[0]
> props=[(cl.context_properties.PLATFORM,
> platform)]+get_gl_sharing_context_properties()
> print (props)
> ctx = cl.Context(properties=props)
>
> I get the following:
> [(4228, <pyopencl.Platform 'NVIDIA CUDA' at 0x55fecb4a14b0>), (8200,
> <OpenGL.raw.GLX._types.LP_struct___GLXcontextRec object at
> 0x7f37dcee91e0>), (8202, <OpenGL.raw.GLX._types.LP_struct__XDisplay object
> at 0x7f378907de18>)]
> Traceback (most recent call last):
>   File "/home/myname/Desktop/myprogram/main.py", line 9, in <module>
>     ctx = cl.Context(properties=props)
> RuntimeError: Unable to cast Python instance to C++ type (compile in debug
> mode for details)
>
> I also don't know how to compile in debug mode (apologies), so I'm
> struggling to diagnose the problem. Any help or advice would be appreciated.

I think what's needed is a way to convert that XDisplay object to a raw
pointer. It seems that the way PyOpenGL handles that changes
periodically, so I'd be happy to take a patch that updates it to the
most recent way. I don't have hardware to test GL interop (all my GPUs
are headless), so I'll have to rely on you to help me.

Thanks,
Andreas

Attachment: signature.asc
Description: PGP signature

_______________________________________________
PyOpenCL mailing list -- pyopencl@tiker.net
To unsubscribe send an email to pyopencl-le...@tiker.net

Reply via email to