Home · All Classes
  • Modules
  • QtCLGL
  • QCLContextGL
  • Contents

    QCLContextGL Class Reference

    The QCLContextGL class represents an OpenCL context that is suitable for use with OpenGL objects. More...

        #include <QCLContextGL>

    Inherits QCLContext.

    This class was introduced in QtOpenCL 4.7.

    Public Functions

    QCLContextGL ()
    ~QCLContextGL ()
    QCLEvent acquire ( const QCLMemoryObject & mem )
    QCLEvent acquire ( const QCLMemoryObject & mem, const QCLEventList & after )
    bool create ( const QCLPlatform & platform = QCLPlatform() )
    QCLBuffer createGLBuffer ( GLuint bufobj, QCLMemoryObject::Access access )
    QCLBuffer createGLBuffer ( QGLBuffer * bufobj, QCLMemoryObject::Access access )
    QCLImage2D createRenderbuffer ( GLuint renderbuffer, QCLMemoryObject::Access access )
    QCLImage2D createTexture2D ( GLenum type, GLuint texture, GLint mipmapLevel, QCLMemoryObject::Access access )
    QCLImage2D createTexture2D ( GLuint texture, QCLMemoryObject::Access access )
    QCLImage3D createTexture3D ( GLenum type, GLuint texture, GLint mipmapLevel, QCLMemoryObject::Access access )
    QCLImage3D createTexture3D ( GLuint texture, QCLMemoryObject::Access access )
    QCLEvent release ( const QCLMemoryObject & mem )
    QCLEvent release ( const QCLMemoryObject & mem, const QCLEventList & after )
    bool supportsObjectSharing () const

    Reimplemented Public Functions

    virtual void release ()

    Static Public Members

    bool isGLBuffer ( const QCLBuffer & buffer )
    bool isRenderbuffer ( const QCLImage2D & image )
    bool isTexture2D ( const QCLImage2D & image )
    bool isTexture3D ( const QCLImage3D & image )

    Detailed Description

    The QCLContextGL class represents an OpenCL context that is suitable for use with OpenGL objects.

    Member Function Documentation

    QCLContextGL::QCLContextGL ()

    Constructs a new OpenCL context object that is suitable for use with OpenGL objects.

    QCLContextGL::~QCLContextGL ()

    Destroys this OpenCL context.

    QCLEvent QCLContextGL::acquire ( const QCLMemoryObject & mem )

    Acquires access to the OpenGL object behind the OpenCL memory object mem. This function must be called before performing an OpenCL operation on any OpenGL memory object.

    Returns an event object that can be used to wait for the request to finish. The request is executed on the active command queue for this context.

    See also release().

    QCLEvent QCLContextGL::acquire ( const QCLMemoryObject & mem, const QCLEventList & after )

    This is an overloaded function.

    Acquires access to the OpenGL object behind the OpenCL memory object mem. This function must be called before performing an OpenCL operation on any OpenGL memory object.

    The request will not start until all of the events in after have been signaled as finished.

    Returns an event object that can be used to wait for the request to finish. The request is executed on the active command queue for this context.

    See also release().

    bool QCLContextGL::create ( const QCLPlatform & platform = QCLPlatform() )

    Creates an OpenCL context that is compatible with the current QGLContext and platform. Returns false if there is no OpenGL context current or the OpenCL context could not be created for some reason.

    This function will first try to create a QCLDevice::GPU device, and will then fall back to QCLDevice::Default if a GPU is not found.

    If platform is null, then the first platform that has a GPU will be used. If there is no GPU, then the first platform with a default device will be used.

    See also supportsObjectSharing().

    QCLBuffer QCLContextGL::createGLBuffer ( GLuint bufobj, QCLMemoryObject::Access access )

    Creates an OpenCL memory buffer from the OpenGL buffer object bufobj, with the specified access mode.

    This function will only work if supportsObjectSharing() is true.

    QCLBuffer QCLContextGL::createGLBuffer ( QGLBuffer * bufobj, QCLMemoryObject::Access access )

    This is an overloaded function.

    Creates an OpenCL memory buffer from the OpenGL buffer object bufobj, with the specified access mode.

    This function will only work if supportsObjectSharing() is true.

    QCLImage2D QCLContextGL::createRenderbuffer ( GLuint renderbuffer, QCLMemoryObject::Access access )

    Creates a 2D OpenCL image object from the specified OpenGL renderbuffer object, and the access mode.

    This function will only work if supportsObjectSharing() is true.

    See also createTexture2D().

    QCLImage2D QCLContextGL::createTexture2D ( GLenum type, GLuint texture, GLint mipmapLevel, QCLMemoryObject::Access access )

    Creates a 2D OpenCL image object from the specified mipmapLevel, OpenGL texture object, and access mode.

    The type must be one of GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_RECTANGLE. The texture does not need to be bound to an OpenGL texture target.

    This function will only work if supportsObjectSharing() is true.

    See also createTexture3D() and createRenderbuffer().

    QCLImage2D QCLContextGL::createTexture2D ( GLuint texture, QCLMemoryObject::Access access )

    This is an overloaded function.

    Creates a 2D OpenCL image object from the specified OpenGL texture object, and the access mode. If texture type is assumed to be GL_TEXTURE_2D and the mipmap level is assumed to be 0.

    This function will only work if supportsObjectSharing() is true.

    QCLImage3D QCLContextGL::createTexture3D ( GLenum type, GLuint texture, GLint mipmapLevel, QCLMemoryObject::Access access )

    Creates a 3D OpenCL image object from the specified mipmapLevel, OpenGL texture object, and access mode.

    The type must be GL_TEXTURE_3D. The texture does not need to be bound to an OpenGL texture target.

    This function will only work if supportsObjectSharing() is true.

    See also createTexture2D().

    QCLImage3D QCLContextGL::createTexture3D ( GLuint texture, QCLMemoryObject::Access access )

    This is an overloaded function.

    Creates a 3D OpenCL image object from the specified OpenGL texture object, and access mode. If texture type is assumed to be GL_TEXTURE_3D and the mipmap level is assumed to be 0.

    This function will only work if supportsObjectSharing() is true.

    bool QCLContextGL::isGLBuffer ( const QCLBuffer & buffer ) [static]

    Returns true if the OpenCL buffer object is also an OpenGL buffer object; false otherwise.

    bool QCLContextGL::isRenderbuffer ( const QCLImage2D & image ) [static]

    Returns true if the 2D OpenCL image object is also an OpenGL renderbuffer object; false otherwise.

    See also isTexture2D().

    bool QCLContextGL::isTexture2D ( const QCLImage2D & image ) [static]

    Returns true if the 2D OpenCL image object is also an OpenGL 2D texture object; false otherwise.

    See also isRenderbuffer() and isTexture3D().

    bool QCLContextGL::isTexture3D ( const QCLImage3D & image ) [static]

    Returns true if the 3D OpenCL image object is also an OpenGL 3D texture object; false otherwise.

    See also isTexture2D().

    void QCLContextGL::release () [virtual]

    Reimplemented from QCLContext::release().

    QCLEvent QCLContextGL::release ( const QCLMemoryObject & mem )

    Releases access to the OpenGL object behind the OpenCL memory object mem. This function must be called after performing an OpenCL operation on any OpenGL memory object, and before performing OpenGL operations on the object.

    Returns an event object that can be used to wait for the request to finish. The request is executed on the active command queue for this context.

    See also acquire().

    QCLEvent QCLContextGL::release ( const QCLMemoryObject & mem, const QCLEventList & after )

    This is an overloaded function.

    Releases access to the OpenGL object behind the OpenCL memory object mem. This function must be called after performing an OpenCL operation on any OpenGL memory object, and before performing OpenGL operations on the object.

    The request will not start until all of the events in after have been signaled as finished.

    Returns an event object that can be used to wait for the request to finish. The request is executed on the active command queue for this context.

    See also acquire().

    bool QCLContextGL::supportsObjectSharing () const

    Returns true if this OpenCL context supports object sharing with OpenGL; false otherwise.

    See also createGLBuffer(), createTexture2D(), createTexture3D(), and createRenderbuffer().


    Copyright © 2010 Nokia Corporation QtOpenCL Documentation