Index: ../../Applications/jocl/src/com/jogamp/opencl/gl/CLGLTexture2d.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP <+>/*\n * Copyright 2009 - 2010 JogAmp Community. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are\n * permitted provided that the following conditions are met:\n * \n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n * \n * 2. Redistributions in binary form must reproduce the above copyright notice, this list\n * of conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n * The views and conclusions contained in the software and documentation are those of the\n * authors and should not be interpreted as representing official policies, either expressed\n * or implied, of JogAmp Community.\n */\n\npackage com.jogamp.opencl.gl;\n\nimport com.jogamp.opencl.llb.CL;\nimport com.jogamp.opencl.CLContext;\nimport com.jogamp.opencl.CLImageFormat;\nimport com.jogamp.opencl.llb.impl.CLImageFormatImpl;\nimport com.jogamp.opencl.llb.gl.CLGL;\nimport java.nio.Buffer;\n\nimport static com.jogamp.opencl.CLException.*;\nimport static com.jogamp.opencl.llb.CL.*;\n\n/**\n * 2D OpenCL image representing an 2D OpenGL texture.\n * @author Michael Bien\n */\npublic class CLGLTexture2d extends CLGLImage2d implements CLGLTexture {\n\n public final int target;\n \n public final int mipMapLevel;\n\n public CLGLTexture2d(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int target, int mipLevel, int width, int height, long id, int glid, int flags) {\n super(context, directBuffer, format, accessor, width, height, id, glid, flags);\n this.target = target;\n this.mipMapLevel = mipLevel;\n }\n\n static CLGLTexture2d createFromGLTexture2d(CLContext context, B directBuffer, int target, int texture, int mipLevel, int flags) {\n\n CLGLBuffer.checkBuffer(directBuffer, flags);\n\n CL cl = getCL(context);\n int[] result = new int[1];\n CLGL clgli = (CLGL)cl;\n\n long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0);\n checkForError((int)id, \"can not share memory with texture #\"+texture+\".\");\n\n CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);\n\n CLImageFormat format = createUninitializedImageFormat();\n accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);\n\n int width = (int)accessor.getLong(CL_IMAGE_WIDTH);\n int height = (int)accessor.getLong(CL_IMAGE_HEIGHT);\n\n return new CLGLTexture2d(context, directBuffer, format, accessor, target, mipLevel, width, height, id, texture, flags);\n\n }\n\n @Override\n public int getTextureTarget() {\n return target;\n }\n\n @Override\n public int getMipMapLevel() {\n return mipMapLevel;\n }\n\n @Override\n public GLObjectType getGLObjectType() {\n return GLObjectType.GL_OBJECT_TEXTURE2D;\n }\n\n\n}\n =================================================================== --- ../../Applications/jocl/src/com/jogamp/opencl/gl/CLGLTexture2d.java (revision 3630d06bc4858ff82ea8cbe7b699fda211c0ec47) +++ ../../Applications/jocl/src/com/jogamp/opencl/gl/CLGLTexture2d.java (revision ) @@ -63,7 +63,7 @@ CLGL clgli = (CLGL)cl; long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0); - checkForError((int)id, "can not share memory with texture #"+texture+"."); + checkForError(result[0], "can not share memory with texture #"+texture+"."); CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);