[squeak-dev] OpenCL and OpenGL interop

askoh askoh at askoh.com
Mon Jun 7 14:31:20 UTC 2010

Feel free to ask these questions on-list; others might be interested.

On Jun 6, 2010, at 7:20 PM, askoh at askoh.com wrote:

> Josh:
> I would like to use OpenCL and OpenGL interop where they share buffers
> for graphics.

That would be great!

> Anything to prevent that now?

Yes, some work still needs to be done, but nothing too difficult.

> What needs to be done?

In order to share buffers with OpenGL, the OpenCL context-creation function
needs to be passed a handle to the OpenGL context. Unfortunately, if you're
using the Croquet-OpenGL bindings, the context is not readily accessible...
a primitive in the B3DAcceleratorPlugin (#primCreateRenderer:x:y:w:h:)
abstracts away context-creation (hiding whether the renderer uses Direct3D
or OpenGL, and other messy stuff, eg: on some platforms creating a child
window for the OpenGL context to draw into). After all of this, it returns
an integer that acts as a Squeak-specific handle to the renderer.

In short, what needs to be done is to obtain the pointer. This will require
modifications to the B3DAcceleratorPlugin. The easiest thing to do would be
to add another primitive that takes the integer renderer-handle and returns
a pointer (possibly as an ExternalAddress?) to the OpenGL context. This can
then be passed to clCreateContext(). I haven't added convenience methods to
use clCreateContext() in such a fashion, but this should be a
straightforward extension of my existing code (feel free to ask more
questions if this isn't clear).

Of course, if you get this working, I'll be glad to integrate any patches
you provide, and to help you bug the VM people to integrate it as well.


> Thanks,
> Aik-Siong

View this message in context: http://forum.world.st/OpenCL-and-OpenGL-interop-tp2246017p2246017.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.

More information about the Squeak-dev mailing list