CLCREATEFROMGLBUFFER(3clc) | OpenCL Manual | CLCREATEFROMGLBUFFER(3clc) |
clCreateFromGLBuffer - Creates an OpenCL buffer object from an OpenGL buffer object.
cl_mem clCreateFromGLBuffer(cl_context context, cl_mem_flags flags, GLuint bufobj, cl_int * errcode_ret);
context
flags
bufobj
errcode_ret
The size of the GL buffer object data store at the time clCreateFromGLBuffer is called will be used as the size of buffer object returned by clCreateFromGLBuffer. If the state of a GL buffer object is modified through the GL API (e.g. glBufferData) while there exists a corresponding CL buffer object, subsequent use of the CL buffer object will result in undefined behavior.
The clRetainMemObject(3clc) and clReleaseMemObject(3clc) functions can be used to retain and release the buffer object.
The CL buffer object created using clCreateFromGLBuffer can also be used to create a CL 1D image buffer object
Returns a valid non-zero OpenCL buffer object and errcode_ret is set to CL_SUCCESS if the buffer object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
OpenCL Specification[1]
cl_khr_gl_sharing(3clc), clCreateBuffer(3clc), clReleaseMemObject(3clc), clRetainMemObject(3clc)
The Khronos Group
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.
02/03/2019 | The Khronos Group |