Skip to content

PythonQt.QtOpenGL.QGLFunctions

QGLFunctions

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

OpenGL ES 2.0 defines a subset of the OpenGL specification that is common across many desktop and embedded OpenGL implementations. However, it can be difficult to use the functions from that subset because they need to be resolved manually on desktop systems.

QGLFunctions provides a guaranteed API that is available on all OpenGL systems and takes care of function resolution on systems that need it. The recommended way to use QGLFunctions is by direct inheritance:

    class MyGLWidget : public QGLWidget, protected QGLFunctions
    {
        Q_OBJECT
    public:
        MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}

    protected:
        void initializeGL();
        void paintGL();
    };

    void MyGLWidget::initializeGL()
    {
        initializeGLFunctions();
    }

The paintGL() function can then use any of the OpenGL ES 2.0 functions without explicit resolution, such as glActiveTexture() in the following example:

    void MyGLWidget::paintGL()
    {
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_2D, textureId);
        ...
    }

QGLFunctions can also be used directly for ad-hoc invocation of OpenGL ES 2.0 functions on all platforms:

    QGLFunctions glFuncs(QGLContext::currentContext());
    glFuncs.glActiveTexture(GL_TEXTURE1);

QGLFunctions provides wrappers for all OpenGL ES 2.0 functions, except those like glDrawArrays(), glViewport(), and glBindTexture() that don't have portability issues.

Including the header for QGLFunctions will also define all of the OpenGL ES 2.0 macro constants that are not already defined by the system's OpenGL headers, such as GL_TEXTURE1 above.

The hasOpenGLFeature() and openGLFeatures() functions can be used to determine if the OpenGL implementation has a major OpenGL ES 2.0 feature. For example, the following checks if non power of two textures are available:

    QGLFunctions funcs(QGLContext::currentContext());
    bool npot = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);

Note: This class has been deprecated in favor of QOpenGLFunctions.

Source: https://doc.qt.io/archives/qt-5.15/qglfunctions.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
BlendColor attribute Any
BlendEquation attribute Any
BlendEquationSeparate attribute Any
BlendFuncSeparate attribute Any
BlendSubtract attribute Any
Buffers attribute Any
CompressedTextures attribute Any
Framebuffers attribute Any
Multisample attribute Any
Multitexture attribute Any
NPOTTextures attribute Any (shared captured text)
OpenGLFeature attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
OpenGLFeatures attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
Shaders attribute Any
StencilSeparate attribute Any
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
glActiveTexture function (self, texture: Any) -> Any Convenience function that calls glActiveTexture(texture).
glAttachShader function (self, program: Any, shader: Any) -> Any X.glAttachShader(program, shader)
glBindAttribLocation function (self, program: Any, index: Any, name: Any) -> Any X.glBindAttribLocation(program, index, name)
glBindBuffer function (self, target: Any, buffer: Any) -> Any X.glBindBuffer(target, buffer)
glBindFramebuffer function (self, target: Any, framebuffer: Any) -> Any X.glBindFramebuffer(target, framebuffer)
glBindRenderbuffer function (self, target: Any, renderbuffer: Any) -> Any X.glBindRenderbuffer(target, renderbuffer)
glBlendColor function (self, red: Any, green: Any, blue: Any, alpha: Any) -> Any X.glBlendColor(red, green, blue, alpha)
glBlendEquation function (self, mode: Any) -> Any Convenience function that calls glBlendEquation(mode).
glBlendEquationSeparate function (self, modeRGB: Any, modeAlpha: Any) -> Any X.glBlendEquationSeparate(modeRGB, modeAlpha)
glBlendFuncSeparate function (self, srcRGB: Any, dstRGB: Any, srcAlpha: Any, dstAlpha: Any) -> Any X.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha)
glCheckFramebufferStatus function (self, target: Any) -> int X.glCheckFramebufferStatus(target) -> int
glClearDepthf function (self, depth: Any) -> Any Convenience function that calls glClearDepth(depth) on desktop OpenGL systems and glClearDepthf(depth) on embedded OpenGL ES systems.
glCompileShader function (self, shader: Any) -> Any Convenience function that calls glCompileShader(shader).
glCompressedTexImage2D function (self, target: Any, level: Any, internalformat: Any, width: Any, height: Any, border: Any, imageSize: Any, da… X.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data)
glCompressedTexSubImage2D function (self, target: Any, level: Any, xoffset: Any, yoffset: Any, width: Any, height: Any, format: Any, imageSize: … X.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data)
glCreateProgram function (self) -> int X.glCreateProgram() -> int
glCreateShader function (self, type: Any) -> int X.glCreateShader(type) -> int
glDeleteBuffers function (self, n: Any, buffers: Any) -> Any X.glDeleteBuffers(n, buffers)
glDeleteFramebuffers function (self, n: Any, framebuffers: Any) -> Any X.glDeleteFramebuffers(n, framebuffers)
glDeleteProgram function (self, program: Any) -> Any Convenience function that calls glDeleteProgram(program).
glDeleteRenderbuffers function (self, n: Any, renderbuffers: Any) -> Any X.glDeleteRenderbuffers(n, renderbuffers)
glDeleteShader function (self, shader: Any) -> Any Convenience function that calls glDeleteShader(shader).
glDepthRangef function (self, zNear: Any, zFar: Any) -> Any X.glDepthRangef(zNear, zFar)
glDetachShader function (self, program: Any, shader: Any) -> Any X.glDetachShader(program, shader)
glDisableVertexAttribArray function (self, index: Any) -> Any Convenience function that calls glDisableVertexAttribArray(index).
glEnableVertexAttribArray function (self, index: Any) -> Any Convenience function that calls glEnableVertexAttribArray(index).
glFramebufferRenderbuffer function (self, target: Any, attachment: Any, renderbuffertarget: Any, renderbuffer: Any) -> Any X.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer)
glFramebufferTexture2D function (self, target: Any, attachment: Any, textarget: Any, texture: Any, level: Any) -> Any X.glFramebufferTexture2D(target, attachment, textarget, texture, level)
glGenBuffers function (self, n: Any, buffers: Any) -> Any X.glGenBuffers(n, buffers)
glGenFramebuffers function (self, n: Any, framebuffers: Any) -> Any X.glGenFramebuffers(n, framebuffers)
glGenRenderbuffers function (self, n: Any, renderbuffers: Any) -> Any X.glGenRenderbuffers(n, renderbuffers)
glGenerateMipmap function (self, target: Any) -> Any Convenience function that calls glGenerateMipmap(target).
glGetActiveAttrib function (self, program: Any, index: Any, bufsize: Any, length: Any, size: Any, type: Any, name: Any) -> Any X.glGetActiveAttrib(program, index, bufsize, length, size, type, name)
glGetActiveUniform function (self, program: Any, index: Any, bufsize: Any, length: Any, size: Any, type: Any, name: Any) -> Any X.glGetActiveUniform(program, index, bufsize, length, size, type, name)
glGetAttachedShaders function (self, program: Any, maxcount: Any, count: Any, shaders: Any) -> Any X.glGetAttachedShaders(program, maxcount, count, shaders)
glGetAttribLocation function (self, program: Any, name: Any) -> int X.glGetAttribLocation(program, name) -> int
glGetBufferParameteriv function (self, target: Any, pname: Any, params: Any) -> Any X.glGetBufferParameteriv(target, pname, params)
glGetFramebufferAttachmentParameteriv function (self, target: Any, attachment: Any, pname: Any, params: Any) -> Any X.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params)
glGetProgramInfoLog function (self, program: Any, bufsize: Any, length: Any, infolog: Any) -> Any X.glGetProgramInfoLog(program, bufsize, length, infolog)
glGetProgramiv function (self, program: Any, pname: Any, params: Any) -> Any X.glGetProgramiv(program, pname, params)
glGetRenderbufferParameteriv function (self, target: Any, pname: Any, params: Any) -> Any X.glGetRenderbufferParameteriv(target, pname, params)
glGetShaderInfoLog function (self, shader: Any, bufsize: Any, length: Any, infolog: Any) -> Any X.glGetShaderInfoLog(shader, bufsize, length, infolog)
glGetShaderPrecisionFormat function (self, shadertype: Any, precisiontype: Any, range: Any, precision: Any) -> Any X.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision)
glGetShaderSource function (self, shader: Any, bufsize: Any, length: Any, source: Any) -> Any X.glGetShaderSource(shader, bufsize, length, source)
glGetShaderiv function (self, shader: Any, pname: Any, params: Any) -> Any X.glGetShaderiv(shader, pname, params)
glGetUniformLocation function (self, program: Any, name: Any) -> int X.glGetUniformLocation(program, name) -> int
glGetUniformfv function (self, program: Any, location: Any, params: Any) -> Any X.glGetUniformfv(program, location, params)
glGetUniformiv function (self, program: Any, location: Any, params: Any) -> Any X.glGetUniformiv(program, location, params)
glGetVertexAttribPointerv function (self, index: Any, pname: Any, pointer: Any) -> Any X.glGetVertexAttribPointerv(index, pname, pointer)
glGetVertexAttribfv function (self, index: Any, pname: Any, params: Any) -> Any X.glGetVertexAttribfv(index, pname, params)
glGetVertexAttribiv function (self, index: Any, pname: Any, params: Any) -> Any X.glGetVertexAttribiv(index, pname, params)
glIsBuffer function (self, buffer: Any) -> int X.glIsBuffer(buffer) -> int
glIsFramebuffer function (self, framebuffer: Any) -> int X.glIsFramebuffer(framebuffer) -> int
glIsProgram function (self, program: Any) -> int X.glIsProgram(program) -> int
glIsRenderbuffer function (self, renderbuffer: Any) -> int X.glIsRenderbuffer(renderbuffer) -> int
glIsShader function (self, shader: Any) -> int X.glIsShader(shader) -> int
glLinkProgram function (self, program: Any) -> Any Convenience function that calls glLinkProgram(program).
glReleaseShaderCompiler function (self) -> Any Convenience function that calls glReleaseShaderCompiler().
glRenderbufferStorage function (self, target: Any, internalformat: Any, width: Any, height: Any) -> Any X.glRenderbufferStorage(target, internalformat, width, height)
glSampleCoverage function (self, value: Any, invert: Any) -> Any X.glSampleCoverage(value, invert)
glShaderBinary function (self, n: Any, shaders: Any, binaryformat: Any, binary: Any, length: Any) -> Any X.glShaderBinary(n, shaders, binaryformat, binary, length)
glShaderSource function (self, shader: Any, count: Any, string: Any, length: Any) -> Any X.glShaderSource(shader, count, string, length)
glStencilFuncSeparate function (self, face: Any, func: Any, ref: Any, mask: Any) -> Any X.glStencilFuncSeparate(face, func, ref, mask)
glStencilMaskSeparate function (self, face: Any, mask: Any) -> Any X.glStencilMaskSeparate(face, mask)
glStencilOpSeparate function (self, face: Any, fail: Any, zfail: Any, zpass: Any) -> Any X.glStencilOpSeparate(face, fail, zfail, zpass)
glUniform1f function (self, location: Any, x: Any) -> Any X.glUniform1f(location, x)
glUniform1fv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform1fv(location, count, v)
glUniform1i function (self, location: Any, x: Any) -> Any X.glUniform1i(location, x)
glUniform1iv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform1iv(location, count, v)
glUniform2f function (self, location: Any, x: Any, y: Any) -> Any X.glUniform2f(location, x, y)
glUniform2fv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform2fv(location, count, v)
glUniform2i function (self, location: Any, x: Any, y: Any) -> Any X.glUniform2i(location, x, y)
glUniform2iv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform2iv(location, count, v)
glUniform3f function (self, location: Any, x: Any, y: Any, z: Any) -> Any X.glUniform3f(location, x, y, z)
glUniform3fv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform3fv(location, count, v)
glUniform3i function (self, location: Any, x: Any, y: Any, z: Any) -> Any X.glUniform3i(location, x, y, z)
glUniform3iv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform3iv(location, count, v)
glUniform4f function (self, location: Any, x: Any, y: Any, z: Any, w: Any) -> Any X.glUniform4f(location, x, y, z, w)
glUniform4fv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform4fv(location, count, v)
glUniform4i function (self, location: Any, x: Any, y: Any, z: Any, w: Any) -> Any X.glUniform4i(location, x, y, z, w)
glUniform4iv function (self, location: Any, count: Any, v: Any) -> Any X.glUniform4iv(location, count, v)
glUniformMatrix2fv function (self, location: Any, count: Any, transpose: Any, value: Any) -> Any X.glUniformMatrix2fv(location, count, transpose, value)
glUniformMatrix3fv function (self, location: Any, count: Any, transpose: Any, value: Any) -> Any X.glUniformMatrix3fv(location, count, transpose, value)
glUniformMatrix4fv function (self, location: Any, count: Any, transpose: Any, value: Any) -> Any X.glUniformMatrix4fv(location, count, transpose, value)
glUseProgram function (self, program: Any) -> Any Convenience function that calls glUseProgram(program).
glValidateProgram function (self, program: Any) -> Any Convenience function that calls glValidateProgram(program).
glVertexAttrib1f function (self, indx: Any, x: Any) -> Any X.glVertexAttrib1f(indx, x)
glVertexAttrib1fv function (self, indx: Any, values: Any) -> Any X.glVertexAttrib1fv(indx, values)
glVertexAttrib2f function (self, indx: Any, x: Any, y: Any) -> Any X.glVertexAttrib2f(indx, x, y)
glVertexAttrib2fv function (self, indx: Any, values: Any) -> Any X.glVertexAttrib2fv(indx, values)
glVertexAttrib3f function (self, indx: Any, x: Any, y: Any, z: Any) -> Any X.glVertexAttrib3f(indx, x, y, z)
glVertexAttrib3fv function (self, indx: Any, values: Any) -> Any X.glVertexAttrib3fv(indx, values)
glVertexAttrib4f function (self, indx: Any, x: Any, y: Any, z: Any, w: Any) -> Any X.glVertexAttrib4f(indx, x, y, z, w)
glVertexAttrib4fv function (self, indx: Any, values: Any) -> Any X.glVertexAttrib4fv(indx, values)
glVertexAttribPointer function (self, indx: Any, size: Any, type: Any, normalized: Any, stride: Any, ptr: Any) -> Any X.glVertexAttribPointer(indx, size, type, normalized, stride, ptr)
hasOpenGLFeature function (self, feature: Any) -> bool X.hasOpenGLFeature(feature) -> bool
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initializeGLFunctions function (self, context: Any) -> Any Initializes GL function resolution for context.
openGLFeatures function (self) -> Any Returns the set of features that are present on this system's OpenGL implementation.