'\" t .\" Title: clCreateFromGLTexture .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLCREATEFROMGLTEXTUR" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" clCreateFromGLTexture \- Creates an OpenCL image object, image array object, or image buffer object from an OpenGL texture object, texture array object, texture buffer object, or a single face of an OpenGL cubemap texture object\&. .SH "" .HP \w'cl_mem\ clCreateFromGLTexture('u .BI "cl_mem clCreateFromGLTexture(cl_context\ " "context" ", cl_mem_flags\ " "flags" ", GLenum\ " "texture_target" ", GLint\ " "miplevel" ", GLuint\ " "texture" ", cl_int\ *" "\ errcode_ret" ");" .SH "PARAMETERS" .PP \fI context \fR .RS 4 A valid OpenCL context created from an OpenGL context\&. .RE .PP \fI flags \fR .RS 4 A bit\-field that is used to specify usage information\&. Refer to the table for \fB\fBclCreateBuffer\fR(3clc)\fRfor a description of \fIflags\fR\&. Only the values \fBCL_MEM_READ_ONLY\fR, \fBCL_MEM_WRITE_ONLY\fR and \fBCL_MEM_READ_WRITE\fR can be used\&. .RE .PP \fI texture_target \fR .RS 4 \fItexture_target\fR This value must be one of \fBGL_TEXTURE_1D\fR, \fBGL_TEXTURE_1D_ARRAY\fR, \fBGL_TEXTURE_BUFFER\fR, \fBGL_TEXTURE_2D\fR, \fBGL_TEXTURE_2D_ARRAY\fR, \fBGL_TEXTURE_3D\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_X\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_Y\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_Z\fR, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_X\fR, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_Y\fR, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_Z\fR, or \fBGL_TEXTURE_RECTANGLE\fR\&. This requires OpenGL 3\&.1\&. Alternatively, \fBGL_TEXTURE_RECTANGLE_ARB\fR may be specified if the OpenGL extension GL_ARB_texture_rectangle is supported\&. \fItexture_target\fR is used only to define the image type of \fItexture\fR\&. No reference to a bound GL texture object is made or implied by this parameter\&. .RE .PP \fI miplevel \fR .RS 4 The mipmap level to be used\&. If \fItexture_target\fR is \fBGL_TEXTURE_BUFFER\fR, miplevel must be 0\&. Implementations may return \fBCL_INVALID_OPERATION\fR for miplevel values > 0 .RE .PP \fI texture \fR .RS 4 The name of a GL 1D, 2D, 3D, 1D array, 2D array, cubemap, rectangle or buffer texture object\&. The texture object must be a complete texture as per OpenGL rules on texture completeness\&. The \fItexture\fR format and dimensions defined by OpenGL for the specified \fImiplevel\fR of the texture will be used to create the OpenCL image memory object\&. Only GL texture objects with an internal format that maps to appropriate image channel order and data type specified in tables 5\&.5 and 5\&.6 may be used to create the OpenCL image memory object\&. .RE .PP \fI errcode_ret \fR .RS 4 Returns an appropriate error code as described below\&. If \fIerrcode_ret\fR is NULL, no error code is returned\&. .RE .SH "NOTES" .PP If the state of a GL texture object is modified through the GL API (e\&.g\&. \fBglTexImage2D\fR, \fBglTexImage3D\fR or the values of the texture parameters \fBGL_TEXTURE_BASE_LEVEL\fR or \fBGL_TEXTURE_MAX_LEVEL\fR are modified) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior\&. .PP The \fBclRetainMemObject\fR(3clc) and \fBclReleaseMemObject\fR(3clc) functions can be used to retain and release the image objects\&. .SH "ERRORS" .PP Returns a valid non\-zero OpenCL image object and \fIerrcode_ret\fR is set to CL_SUCCESS if the image object is created successfully\&. Otherwise, it returns a NULL value with one of the following error values returned in \fIerrcode_ret\fR: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_CONTEXT if \fIcontext\fR is not a valid context or was not created from a GL context\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if values specified in \fIflags\fR are not valid or if value specified in \fItexture_target\fR is not one of the values specified in the description of \fItexture_target\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_MIP_LEVEL if \fImiplevel\fR is less than the value of \fIlevel\fR\fIbase\fR (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value of \fIq\fR (for both OpenGL and OpenGL ES)\&. \fIlevel\fR\fIbase\fR and \fIq\fR are defined for the texture in section 3\&.8\&.10 (Texture Completeness) of the OpenGL 2\&.1 specification and section 3\&.7\&.10 of the OpenGL ES 2\&.0\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_MIP_LEVEL if \fImiplevel\fR is greater than zero and the OpenGL implementation does not support creating from non\-zero mipmap levels\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_GL_OBJECT if \fItexture\fR is not a GL texture object whose type matches \fItexture_target\fR, if the specified \fImiplevel\fR of \fItexture\fR is not defined, or if the width or height of the specified \fImiplevel\fR is zero\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_IMAGE_FORMAT_DESCRIPTOR if the OpenGL texture internal format does not map to a supported OpenCL image format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_OPERATION if texture is a GL texture object created with a border width value greater than zero\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" obsolete page replaced by clCreateFromGLTexture .PP \fBcl_khr_gl_sharing\fR(3clc), \fBclCreateBuffer\fR(3clc), \fBclCreateFromGLTexture\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 50, section 9.7.3 - CL Image Objects -> GL Textures .RE