RobotRock
RobotRock

Reputation: 4459

OpenGL / OpenCL sharing with LWJGL

I can not find much about the OpenCL Java implementation in LWJGL. For instance device.isSharingSupported is not in LWJGL, or not implemented in the usual way for that matter. Can anyone elaborate on this?

So I'm interested in sharing textures / vertices from opencl with opengl. Would it be wise to switch to JOGL?

Upvotes: 1

Views: 997

Answers (1)

Spasi
Spasi

Reputation: 116

This is how you'd query the CLDevices that support KHR_gl_sharing in LWJGL:

CLPlatform platform = CLPlatform.getPlatforms().get(0);
List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_ALL, new Filter<CLDevice>() {
    public boolean accept(CLDevice device) {
        CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
        return caps.CL_KHR_gl_sharing;
    }
});

See org.lwjgl.test.opencl.gl.DemoFractal in LWJGL's test package for a complete example. You can also see the source here.

Upvotes: 3

Related Questions