29package com.jogamp.opencl.gl;
31import com.jogamp.opencl.CLBuffer;
32import com.jogamp.opencl.CLCommandQueue;
33import com.jogamp.opencl.CLContext;
34import com.jogamp.opencl.CLException;
35import com.jogamp.opencl.llb.CL;
37import java.nio.Buffer;
38import com.jogamp.opengl.GLContext;
53 private CLGLBuffer(
final CLContext context,
final B directBuffer,
final long id,
final int glObject,
final long size,
final int flags) {
54 super(context, directBuffer,
size,
id, flags);
59 static <B extends Buffer>
CLGLBuffer<B> create(
final CLContext context,
final B directBuffer,
final long size,
final int flags,
final int glBuffer) {
60 checkBuffer(directBuffer, flags);
63 final int[] result =
new int[1];
70 static <B extends Buffer>
void checkBuffer(
final B directBuffer,
final int flags)
throws IllegalArgumentException {
71 if (directBuffer !=
null && !directBuffer.isDirect()) {
72 throw new IllegalArgumentException(
"buffer is not a direct buffer");
75 throw new IllegalArgumentException(
"CL_MEM_COPY_HOST_PTR or CL_MEM_USE_HOST_PTR can not be used with OpenGL Buffers.");
110 public <T extends Buffer>
CLGLBuffer<T> cloneWith(
final T directBuffer) {
116 return getClass().getSimpleName()+
" [id: " + ID+
" glID: "+
GLID+
"]";
OpenCL buffer object wrapping an optional NIO buffer.
CLContext is responsible for managing objects such as command-queues, memory, program and kernel obje...
Main Exception type for runtime OpenCL errors and failed function calls (e.g.
static void checkForError(final int status, final String message)
Throws a CLException when status != CL_SUCCESS.
final void initCLCapacity()
static CL getCL(final CLContext context)
static boolean isHostPointerFlag(final int flags)
Returns true if a host pointer must be specified on mem object creation.
static long getSizeImpl(final CLContext context, final long id)
final long ID
The OpenCL object handle.
Shared buffer between OpenGL and OpenCL contexts.
int getGLObjectID()
Returns the OpenGL object id of this shared object.
GLObjectType getGLObjectType()
Returns the OpenGL buffer type of this shared object.
CLGLContext getContext()
Returns the OpenCL context of this shared object.
void updateSize()
Updates the size of this CLGLBuffer by querying OpenGL.
GLContext getGLContext()
Returns the OpenGL context of this shared object.
final int GLID
The OpenGL object handle.
OpenCL Context supporting JOGL-JOCL interoperablity.
GLContext getGLContext()
Returns the OpenGL context this context was shared with.
CLGLContext getContext()
Returns the context for this OpenCL object.
Java bindings to OpenCL, the Open Computing Language.
long clCreateFromGLBuffer(long context, long flags, int bufobj, IntBuffer errcode_ret)
Interface to C language function: cl_mem {@native clCreateFromGLBuffer}(cl_context context,...