summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLGLContext.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-02-27 00:44:33 +0100
committerMichael Bien <[email protected]>2010-02-27 00:44:33 +0100
commit34bb39283a30919212b682c34bb54d8cd3626cbd (patch)
tree5f70f3473cdfffa8562a558cebcec6aa30af8fc7 /src/com/mbien/opencl/CLGLContext.java
parent75d392f3fff6d47fdccae9a8915fea61cdbef990 (diff)
refactored CLGLBuffer into seperate OpenGL buffer and image types.
Diffstat (limited to 'src/com/mbien/opencl/CLGLContext.java')
-rw-r--r--src/com/mbien/opencl/CLGLContext.java62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/com/mbien/opencl/CLGLContext.java b/src/com/mbien/opencl/CLGLContext.java
index 49fa7fac..5c7226c9 100644
--- a/src/com/mbien/opencl/CLGLContext.java
+++ b/src/com/mbien/opencl/CLGLContext.java
@@ -13,7 +13,7 @@ import javax.media.opengl.GLContext;
import static com.mbien.opencl.CLGLI.*;
/**
- * OpenCL Context supporting interoperablity between JOGL and JOCL.
+ * OpenCL Context supporting JOGL-JOCL interoperablity.
* @author Michael Bien
*/
public final class CLGLContext extends CLContext {
@@ -146,7 +146,7 @@ public final class CLGLContext extends CLContext {
return properties.put(0).rewind(); // 0 terminated array
}
-
+ // Buffers
public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, Mem... flags) {
return createFromGLBuffer(null, glBuffer, Mem.flagsToInt(flags));
}
@@ -165,4 +165,62 @@ public final class CLGLContext extends CLContext {
return buffer;
}
+ // Renderbuffers
+ public final CLGLImage2d<?> createFromGLRenderbuffer(int glBuffer, Mem... flags) {
+ return createFromGLRenderbuffer(null, glBuffer, Mem.flagsToInt(flags));
+ }
+
+ public final CLGLImage2d<?> createFromGLRenderbuffer(int glBuffer, int flags) {
+ return createFromGLRenderbuffer(null, glBuffer, flags);
+ }
+
+ public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(B directBuffer, int glBuffer, Mem... flags) {
+ return createFromGLRenderbuffer(directBuffer, glBuffer, Mem.flagsToInt(flags));
+ }
+
+ public final <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(B directBuffer, int glBuffer, int flags) {
+ CLGLImage2d<B> buffer = CLGLImage2d.createFromGLRenderbuffer(this, directBuffer, flags, glBuffer);
+ memoryObjects.add(buffer);
+ return buffer;
+ }
+
+ //2d Textures
+ public final CLGLTexture2d<?> createFromGLTexture2d(int target, int texture, int mipmap, Mem... flags) {
+ return createFromGLTexture2d(null, target, texture, mipmap, Mem.flagsToInt(flags));
+ }
+
+ public final CLGLTexture2d<?> createFromGLTexture2d(int target, int texture, int mipmap, int flags) {
+ return createFromGLTexture2d(null, target, texture, mipmap, flags);
+ }
+
+ public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, Mem... flags) {
+ return createFromGLTexture2d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags));
+ }
+
+ public final <B extends Buffer> CLGLTexture2d<B> createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, int flags) {
+ CLGLTexture2d<B> buffer = CLGLTexture2d.createFromGLTexture2d(this, directBuffer, target, texture, mipmap, flags);
+ memoryObjects.add(buffer);
+ return buffer;
+ }
+
+ //3d Textures
+ public final CLGLTexture3d<?> createFromGLTexture3d(int target, int texture, int mipmap, Mem... flags) {
+ return createFromGLTexture3d(null, target, texture, mipmap, Mem.flagsToInt(flags));
+ }
+
+ public final CLGLTexture3d<?> createFromGLTexture3d(int target, int texture, int mipmap, int flags) {
+ return createFromGLTexture3d(null, target, texture, mipmap, flags);
+ }
+
+ public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, Mem... flags) {
+ return createFromGLTexture3d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags));
+ }
+
+ public final <B extends Buffer> CLGLTexture3d<B> createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, int flags) {
+ CLGLTexture3d<B> buffer = CLGLTexture3d.createFromGLTexture3d(this, directBuffer, target, texture, mipmap, flags);
+ memoryObjects.add(buffer);
+ return buffer;
+ }
+
+
}