From 34bb39283a30919212b682c34bb54d8cd3626cbd Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 27 Feb 2010 00:44:33 +0100 Subject: refactored CLGLBuffer into seperate OpenGL buffer and image types. --- src/com/mbien/opencl/CLGLContext.java | 62 +++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) (limited to 'src/com/mbien/opencl/CLGLContext.java') 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 CLGLImage2d createFromGLRenderbuffer(B directBuffer, int glBuffer, Mem... flags) { + return createFromGLRenderbuffer(directBuffer, glBuffer, Mem.flagsToInt(flags)); + } + + public final CLGLImage2d createFromGLRenderbuffer(B directBuffer, int glBuffer, int flags) { + CLGLImage2d 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 CLGLTexture2d createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, Mem... flags) { + return createFromGLTexture2d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags)); + } + + public final CLGLTexture2d createFromGLTexture2d(B directBuffer, int target, int texture, int mipmap, int flags) { + CLGLTexture2d 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 CLGLTexture3d createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, Mem... flags) { + return createFromGLTexture3d(directBuffer, target, texture, mipmap, Mem.flagsToInt(flags)); + } + + public final CLGLTexture3d createFromGLTexture3d(B directBuffer, int target, int texture, int mipmap, int flags) { + CLGLTexture3d buffer = CLGLTexture3d.createFromGLTexture3d(this, directBuffer, target, texture, mipmap, flags); + memoryObjects.add(buffer); + return buffer; + } + + } -- cgit v1.2.3