QGLFunctions Class ReferenceThe QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API. More... #include <QGLFunctions> This class was introduced in Qt 4.8. Public Types
Public Functions
Detailed DescriptionThe QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API. 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); Member Type Documentation
flags QGLFunctions::OpenGLFeatures |
Constant | Value | Description |
---|---|---|
QGLFunctions::Multitexture | 0x0001 | glActiveTexture() function is available. |
QGLFunctions::Shaders | 0x0002 | Shader functions are available. |
QGLFunctions::Buffers | 0x0004 | Vertex and index buffer functions are available. |
QGLFunctions::Framebuffers | 0x0008 | Framebuffer object functions are available. |
QGLFunctions::BlendColor | 0x0010 | glBlendColor() is available. |
QGLFunctions::BlendEquation | 0x0020 | glBlendEquation() is available. |
QGLFunctions::BlendEquationSeparate | 0x0040 | glBlendEquationSeparate() is available. |
QGLFunctions::BlendFuncSeparate | 0x0080 | glBlendFuncSeparate() is available. |
QGLFunctions::BlendSubtract | 0x0100 | Blend subtract mode is available. |
QGLFunctions::CompressedTextures | 0x0200 | Compressed texture functions are available. |
QGLFunctions::Multisample | 0x0400 | glSampleCoverage() function is available. |
QGLFunctions::StencilSeparate | 0x0800 | Separate stencil functions are available. |
QGLFunctions::NPOTTextures | 0x1000 | Non power of two textures are available. |
The OpenGLFeatures type is a typedef for QFlags<OpenGLFeature>. It stores an OR combination of OpenGLFeature values.
Constructs a default function resolver. The resolver cannot be used until initializeGLFunctions() is called to specify the context.
See also initializeGLFunctions().
Constructs a function resolver for context. If context is null, then the resolver will be created for the current QGLContext.
An object constructed in this way can only be used with context and other contexts that share with it. Use initializeGLFunctions() to change the object's context association.
See also initializeGLFunctions().
Destroys this function resolver.
Convenience function that calls glActiveTexture(texture).
For more information, see the OpenGL/ES 2.0 documentation for glActiveTexture().
Convenience function that calls glAttachShader(program, shader).
For more information, see the OpenGL/ES 2.0 documentation for glAttachShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glBindAttribLocation(program, index, name).
For more information, see the OpenGL/ES 2.0 documentation for glBindAttribLocation().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glBindBuffer(target, buffer).
For more information, see the OpenGL/ES 2.0 documentation for glBindBuffer().
Convenience function that calls glBindFramebuffer(target, framebuffer).
For more information, see the OpenGL/ES 2.0 documentation for glBindFramebuffer().
Convenience function that calls glBindRenderbuffer(target, renderbuffer).
For more information, see the OpenGL/ES 2.0 documentation for glBindRenderbuffer().
Convenience function that calls glBlendColor(red, green, blue, alpha).
For more information, see the OpenGL/ES 2.0 documentation for glBlendColor().
Convenience function that calls glBlendEquation(mode).
For more information, see the OpenGL/ES 2.0 documentation for glBlendEquation().
Convenience function that calls glBlendEquationSeparate(modeRGB, modeAlpha).
For more information, see the OpenGL/ES 2.0 documentation for glBlendEquationSeparate().
Convenience function that calls glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha).
For more information, see the OpenGL/ES 2.0 documentation for glBlendFuncSeparate().
Convenience function that calls glBufferData(target, size, data, usage).
For more information, see the OpenGL/ES 2.0 documentation for glBufferData().
Convenience function that calls glBufferSubData(target, offset, size, data).
For more information, see the OpenGL/ES 2.0 documentation for glBufferSubData().
Convenience function that calls glCheckFramebufferStatus(target).
For more information, see the OpenGL/ES 2.0 documentation for glCheckFramebufferStatus().
Convenience function that calls glClearDepth(depth) on desktop OpenGL systems and glClearDepthf(depth) on embedded OpenGL/ES systems.
For more information, see the OpenGL/ES 2.0 documentation for glClearDepthf().
Convenience function that calls glCompileShader(shader).
For more information, see the OpenGL/ES 2.0 documentation for glCompileShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data).
For more information, see the OpenGL/ES 2.0 documentation for glCompressedTexImage2D().
Convenience function that calls glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data).
For more information, see the OpenGL/ES 2.0 documentation for glCompressedTexSubImage2D().
Convenience function that calls glCreateProgram().
For more information, see the OpenGL/ES 2.0 documentation for glCreateProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glCreateShader(type).
For more information, see the OpenGL/ES 2.0 documentation for glCreateShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glDeleteBuffers(n, buffers).
For more information, see the OpenGL/ES 2.0 documentation for glDeleteBuffers().
Convenience function that calls glDeleteFramebuffers(n, framebuffers).
For more information, see the OpenGL/ES 2.0 documentation for glDeleteFramebuffers().
Convenience function that calls glDeleteProgram(program).
For more information, see the OpenGL/ES 2.0 documentation for glDeleteProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glDeleteRenderbuffers(n, renderbuffers).
For more information, see the OpenGL/ES 2.0 documentation for glDeleteRenderbuffers().
Convenience function that calls glDeleteShader(shader).
For more information, see the OpenGL/ES 2.0 documentation for glDeleteShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glDepthRange(zNear, zFar) on desktop OpenGL systems and glDepthRangef(zNear, zFar) on embedded OpenGL/ES systems.
For more information, see the OpenGL/ES 2.0 documentation for glDepthRangef().
Convenience function that calls glDetachShader(program, shader).
For more information, see the OpenGL/ES 2.0 documentation for glDetachShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glDisableVertexAttribArray(index).
For more information, see the OpenGL/ES 2.0 documentation for glDisableVertexAttribArray().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glEnableVertexAttribArray(index).
For more information, see the OpenGL/ES 2.0 documentation for glEnableVertexAttribArray().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer).
For more information, see the OpenGL/ES 2.0 documentation for glFramebufferRenderbuffer().
Convenience function that calls glFramebufferTexture2D(target, attachment, textarget, texture, level).
For more information, see the OpenGL/ES 2.0 documentation for glFramebufferTexture2D().
Convenience function that calls glGenBuffers(n, buffers).
For more information, see the OpenGL/ES 2.0 documentation for glGenBuffers().
Convenience function that calls glGenFramebuffers(n, framebuffers).
For more information, see the OpenGL/ES 2.0 documentation for glGenFramebuffers().
Convenience function that calls glGenRenderbuffers(n, renderbuffers).
For more information, see the OpenGL/ES 2.0 documentation for glGenRenderbuffers().
Convenience function that calls glGenerateMipmap(target).
For more information, see the OpenGL/ES 2.0 documentation for glGenerateMipmap().
Convenience function that calls glGetActiveAttrib(program, index, bufsize, length, size, type, name).
For more information, see the OpenGL/ES 2.0 documentation for glGetActiveAttrib().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetActiveUniform(program, index, bufsize, length, size, type, name).
For more information, see the OpenGL/ES 2.0 documentation for glGetActiveUniform().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetAttachedShaders(program, maxcount, count, shaders).
For more information, see the OpenGL/ES 2.0 documentation for glGetAttachedShaders().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetAttribLocation(program, name).
For more information, see the OpenGL/ES 2.0 documentation for glGetAttribLocation().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetBufferParameteriv(target, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetBufferParameteriv().
Convenience function that calls glGetFramebufferAttachmentParameteriv(target, attachment, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetFramebufferAttachmentParameteriv().
Convenience function that calls glGetProgramInfoLog(program, bufsize, length, infolog).
For more information, see the OpenGL/ES 2.0 documentation for glGetProgramInfoLog().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetProgramiv(program, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetProgramiv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetRenderbufferParameteriv(target, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetRenderbufferParameteriv().
Convenience function that calls glGetShaderInfoLog(shader, bufsize, length, infolog).
For more information, see the OpenGL/ES 2.0 documentation for glGetShaderInfoLog().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision).
For more information, see the OpenGL/ES 2.0 documentation for glGetShaderPrecisionFormat().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetShaderSource(shader, bufsize, length, source).
For more information, see the OpenGL/ES 2.0 documentation for glGetShaderSource().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetShaderiv(shader, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetShaderiv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetUniformLocation(program, name).
For more information, see the OpenGL/ES 2.0 documentation for glGetUniformLocation().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetUniformfv(program, location, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetUniformfv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetUniformiv(program, location, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetUniformiv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetVertexAttribPointerv(index, pname, pointer).
For more information, see the OpenGL/ES 2.0 documentation for glGetVertexAttribPointerv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetVertexAttribfv(index, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetVertexAttribfv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glGetVertexAttribiv(index, pname, params).
For more information, see the OpenGL/ES 2.0 documentation for glGetVertexAttribiv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glIsBuffer(buffer).
For more information, see the OpenGL/ES 2.0 documentation for glIsBuffer().
Convenience function that calls glIsFramebuffer(framebuffer).
For more information, see the OpenGL/ES 2.0 documentation for glIsFramebuffer().
Convenience function that calls glIsProgram(program).
For more information, see the OpenGL/ES 2.0 documentation for glIsProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glIsRenderbuffer(renderbuffer).
For more information, see the OpenGL/ES 2.0 documentation for glIsRenderbuffer().
Convenience function that calls glIsShader(shader).
For more information, see the OpenGL/ES 2.0 documentation for glIsShader().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glLinkProgram(program).
For more information, see the OpenGL/ES 2.0 documentation for glLinkProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glReleaseShaderCompiler().
For more information, see the OpenGL/ES 2.0 documentation for glReleaseShaderCompiler().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glRenderbufferStorage(target, internalformat, width, height).
For more information, see the OpenGL/ES 2.0 documentation for glRenderbufferStorage().
Convenience function that calls glSampleCoverage(value, invert).
For more information, see the OpenGL/ES 2.0 documentation for glSampleCoverage().
Convenience function that calls glShaderBinary(n, shaders, binaryformat, binary, length).
For more information, see the OpenGL/ES 2.0 documentation for glShaderBinary().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glShaderSource(shader, count, string, length).
For more information, see the OpenGL/ES 2.0 documentation for glShaderSource().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glStencilFuncSeparate(face, func, ref, mask).
For more information, see the OpenGL/ES 2.0 documentation for glStencilFuncSeparate().
Convenience function that calls glStencilMaskSeparate(face, mask).
For more information, see the OpenGL/ES 2.0 documentation for glStencilMaskSeparate().
Convenience function that calls glStencilOpSeparate(face, fail, zfail, zpass).
For more information, see the OpenGL/ES 2.0 documentation for glStencilOpSeparate().
Convenience function that calls glUniform1f(location, x).
For more information, see the OpenGL/ES 2.0 documentation for glUniform1f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform1fv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform1fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform1i(location, x).
For more information, see the OpenGL/ES 2.0 documentation for glUniform1i().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform1iv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform1iv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform2f(location, x, y).
For more information, see the OpenGL/ES 2.0 documentation for glUniform2f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform2fv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform2fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform2i(location, x, y).
For more information, see the OpenGL/ES 2.0 documentation for glUniform2i().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform2iv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform2iv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform3f(location, x, y, z).
For more information, see the OpenGL/ES 2.0 documentation for glUniform3f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform3fv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform3fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform3i(location, x, y, z).
For more information, see the OpenGL/ES 2.0 documentation for glUniform3i().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform3iv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform3iv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform4f(location, x, y, z, w).
For more information, see the OpenGL/ES 2.0 documentation for glUniform4f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform4fv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform4fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform4i(location, x, y, z, w).
For more information, see the OpenGL/ES 2.0 documentation for glUniform4i().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniform4iv(location, count, v).
For more information, see the OpenGL/ES 2.0 documentation for glUniform4iv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniformMatrix2fv(location, count, transpose, value).
For more information, see the OpenGL/ES 2.0 documentation for glUniformMatrix2fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniformMatrix3fv(location, count, transpose, value).
For more information, see the OpenGL/ES 2.0 documentation for glUniformMatrix3fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUniformMatrix4fv(location, count, transpose, value).
For more information, see the OpenGL/ES 2.0 documentation for glUniformMatrix4fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glUseProgram(program).
For more information, see the OpenGL/ES 2.0 documentation for glUseProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glValidateProgram(program).
For more information, see the OpenGL/ES 2.0 documentation for glValidateProgram().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib1f(indx, x).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib1f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib1fv(indx, values).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib1fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib2f(indx, x, y).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib2f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib2fv(indx, values).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib2fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib3f(indx, x, y, z).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib3f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib3fv(indx, values).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib3fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib4f(indx, x, y, z, w).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib4f().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttrib4fv(indx, values).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttrib4fv().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Convenience function that calls glVertexAttribPointer(indx, size, type, normalized, stride, ptr).
For more information, see the OpenGL/ES 2.0 documentation for glVertexAttribPointer().
This convenience function will do nothing on OpenGL/ES 1.x systems.
Returns true if feature is present on this system's OpenGL implementation; false otherwise.
It is assumed that the QGLContext associated with this function resolver is current.
See also openGLFeatures().
Initializes GL function resolution for context. If context is null, then the current QGLContext will be used.
After calling this function, the QGLFunctions object can only be used with context and other contexts that share with it. Call initializeGLFunctions() again to change the object's context association.
Returns the set of features that are present on this system's OpenGL implementation.
It is assumed that the QGLContext associated with this function resolver is current.
See also hasOpenGLFeature().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.8 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com