table of contents
CLCREATEFROMGLRENDER(3clc) | OpenCL Manual | CLCREATEFROMGLRENDER(3clc) |
NAME¶
clCreateFromGLRenderbuffer - Creates an OpenCL 2D image object from an OpenGL renderbuffer object.
¶
cl_mem clCreateFromGLRenderbuffer(cl_context context, cl_mem_flags flags, GLuint renderbuffer, cl_int * errcode_ret);
PARAMETERS¶
context
flags
renderbuffer
errcode_ret
DESCRIPTION¶
If the state of a GL renderbuffer object is modified through the GL API (i.e. changes to the dimensions or format used to represent pixels of the GL renderbuffer using appropriate GL API calls such as glRenderbufferStorage) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior.
The clRetainMemObject(3clc) and clReleaseMemObject(3clc) functions can be used to retain and release the image objects.
The table below (Table 9.4) describes the list of GL texture internal formats and the corresponding CL image formats. If a GL texture object with an internal format from the table below is successfully created by OpenGL, then there is guaranteed to be a mapping to one of the corresponding CL image format(s) in that table. Texture objects created with other OpenGL internal formats may (but are not guaranteed to) have a mapping to a CL image format; if such mappings exist, they are guaranteed to preserve all color components, data types, and at least the number of bits/component actually allocated by OpenGL for that format.
GL internal format | CL image format (channel order, channel data type) |
GL_RGBA8 | CL_RGBA, CL_UNORM_INT8 or CL_BGRA, CL_UNORM_INT8 |
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV | CL_RGBA, CL_UNORM_INT8 |
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV | CL_BGRA, CL_UNORM_INT8 |
GL_RGBA16 | CL_RGBA, CL_UNORM_INT16 |
GL_RGBA8I, GL_RGBA8I_EXT | CL_RGBA, CL_SIGNED_INT8 |
GL_RGBA16I, GL_RGBA16I_EXT | CL_RGBA, CL_SIGNED_INT16 |
GL_RGBA32I, GL_RGBA32I_EXT | CL_RGBA, CL_SIGNED_INT32 |
GL_RGBA8UI, GL_RGBA8UI_EXT | CL_RGBA, CL_UNSIGNED_INT8 |
GL_RGBA16UI, GL_RGBA16UI_EXT | CL_RGBA, CL_UNSIGNED_INT16 |
GL_RGBA32UI, GL_RGBA32UI_EXT | CL_RGBA, CL_UNSIGNED_INT32 |
GL_RGBA16F, GL_RGBA16F_ARB | CL_RGBA, CL_HALF_FLOAT |
GL_RGBA32F, GL_RGBA32F_ARB | CL_RGBA, CL_FLOAT |
ERRORS¶
Returns a valid non-zero OpenCL image object and errcode_ret 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 errcode_ret:
SPECIFICATION¶
OpenCL Specification[1]
SEE ALSO¶
cl_khr_gl_sharing(3clc), clCreateBuffer(3clc), cl_image_format(3clc), clRetainMemObject(3clc), clReleaseMemObject(3clc)
AUTHORS¶
The Khronos Group
COPYRIGHT¶
Copyright © 2007-2011 The Khronos Group Inc.
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.
NOTES¶
- 1.
- OpenCL Specification
01/14/2021 | The Khronos Group |