C Specification

To query the OpenGL object and object type used to create an OpenCL memory object, call the function

// Provided by cl_khr_gl_sharing
cl_int clGetGLObjectInfo(
    cl_mem memobj,
    cl_gl_object_type* gl_object_type,
    cl_GLuint* gl_object_name);
clGetGLObjectInfo is provided by the cl_khr_gl_sharing extension.

Parameters

  • memobj is the memory object to query.

  • gl_object_type returns the type of OpenGL object attached to memobj and can be CL_GL_OBJECT_BUFFER, CL_GL_OBJECT_TEXTURE2D, CL_GL_OBJECT_TEXTURE3D, CL_GL_OBJECT_TEXTURE2D_ARRAY, CL_GL_OBJECT_TEXTURE1D, CL_GL_OBJECT_TEXTURE1D_ARRAY, CL_GL_OBJECT_TEXTURE_BUFFER, or CL_GL_OBJECT_RENDERBUFFER. If gl_object_type is NULL, it is ignored

  • gl_object_name returns the OpenGL object name used to create memobj. If gl_object_name is NULL, it is ignored.

Description

clGetGLObjectInfo returns CL_SUCCESS if the call was executed successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_MEM_OBJECT if memobj is not a valid OpenCL memory object.

  • CL_INVALID_GL_OBJECT if there is no OpenGL object associated with memobj.

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

See Also

Document Notes

For more information, see the OpenCL Specification

This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0