org.jocl.cloth
Class SharedMemHandle

java.lang.Object
  extended by org.jocl.cloth.SharedMemHandle
All Implemented Interfaces:
ResourceHandle<org.jocl.cl_mem>

 class SharedMemHandle
extends java.lang.Object
implements ResourceHandle<org.jocl.cl_mem>

Implementation of a ResourceHandle for cl_mem objects that are created from an OpenGL vertex buffer object.


Constructor Summary
SharedMemHandle(CLSetup clSetup, int vbo)
          Creates a new handle for shared cl_mem objects.
 
Method Summary
 void acquire()
          Has to be called before the resource may be obtained
 org.jocl.cl_mem get()
          Returns the resource from this handle.
 void release()
          Has to be called as soon as the resource is not used any more
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SharedMemHandle

SharedMemHandle(CLSetup clSetup,
                int vbo)
Creates a new handle for shared cl_mem objects.

Parameters:
clSetup - The setup containing the context and command queue
vbo - The OpenGL VBO identifier
Method Detail

get

public org.jocl.cl_mem get()
Description copied from interface: ResourceHandle
Returns the resource from this handle. Note that this resource may only be valid between calls to ResourceHandle.acquire() and ResourceHandle.release(). Clients should preferably not store the returned object, but always access the resource by calling this method. This method may return null if the resource has not properly been acquired.

Specified by:
get in interface ResourceHandle<org.jocl.cl_mem>
Returns:
The resource

acquire

public void acquire()
Description copied from interface: ResourceHandle
Has to be called before the resource may be obtained

Specified by:
acquire in interface ResourceHandle<org.jocl.cl_mem>

release

public void release()
Description copied from interface: ResourceHandle
Has to be called as soon as the resource is not used any more

Specified by:
release in interface ResourceHandle<org.jocl.cl_mem>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object