Пример #1
0
        /// <summary>
        /// Creates a new <see cref="OpenCLImage3D"/> from an OpenGL 3D texture object.
        /// </summary>
        /// <param name="context"> A <see cref="OpenCLContext"/> with enabled CL/GL sharing. </param>
        /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="OpenCLImage3D"/>. Only <c>OpenCLMemoryFlags.ReadOnly</c>, <c>OpenCLMemoryFlags.WriteOnly</c> and <c>OpenCLMemoryFlags.ReadWrite</c> are allowed. </param>
        /// <param name="textureTarget"> The image type of texture. Must be GL_TEXTURE_3D. </param>
        /// <param name="mipLevel"> The mipmap level of the OpenGL 2D texture object to be used. </param>
        /// <param name="textureId"> The OpenGL 2D texture object id to use. </param>
        /// <returns> The created <see cref="OpenCLImage2D"/>. </returns>
        public static OpenCLImage3D CreateFromGLTexture3D(OpenCLContext context, OpenCLMemoryFlags flags, int textureTarget, int mipLevel, int textureId)
        {
            CLMemoryHandle  image;
            OpenCLErrorCode error = OpenCLErrorCode.Success;

            image = CL10.CreateFromGLTexture3D(context.Handle, flags, textureTarget, mipLevel, textureId, out error);
            OpenCLException.ThrowOnError(error);

            return(new OpenCLImage3D(image, context, flags));
        }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="ComputeImage3D"/> from an OpenGL 3D texture object.
        /// </summary>
        /// <param name="context"> A <see cref="ComputeContext"/> with enabled CL/GL sharing. </param>
        /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="ComputeImage3D"/>. Only <c>ComputeMemoryFlags.ReadOnly</c>, <c>ComputeMemoryFlags.WriteOnly</c> and <c>ComputeMemoryFlags.ReadWrite</c> are allowed. </param>
        /// <param name="textureTarget"> The image type of texture. Must be GL_TEXTURE_3D. </param>
        /// <param name="mipLevel"> The mipmap level of the OpenGL 2D texture object to be used. </param>
        /// <param name="textureId"> The OpenGL 2D texture object id to use. </param>
        /// <returns> The created <see cref="ComputeImage2D"/>. </returns>
        public static ComputeImage3D CreateFromGLTexture3D(ComputeContext context, ComputeMemoryFlags flags, int textureTarget, int mipLevel, int textureId)
        {
            CLMemoryHandle   image;
            ComputeErrorCode error = ComputeErrorCode.Success;

            image = CL10.CreateFromGLTexture3D(context.Handle, flags, textureTarget, mipLevel, textureId, out error);
            ComputeException.ThrowOnError(error);

            return(new ComputeImage3D(image, context, flags));
        }