Add a way to test if an OpenGL context has the fixed function pipeline available

Due to the mess done in 3.0/3.1 this is trickier than it should be,
so add a convenience method to test that.

Change-Id: I26d77cc8f109820cca3f578c3fa3520e802dc15f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
bb10
Giuseppe D'Angelo 2013-07-02 19:45:11 +02:00 committed by The Qt Project
parent b6a6d590e9
commit ee79d94271
2 changed files with 10 additions and 1 deletions

View File

@ -158,6 +158,7 @@ QT_BEGIN_NAMESPACE
\value StencilSeparate Separate stencil functions are available.
\value NPOTTextures Non power of two textures are available.
\value NPOTTextureRepeat Non power of two textures can use GL_REPEAT as wrap parameter.
\value FixedFunctionPipeline The fixed function pipeline is available.
*/
// Hidden private fields for additional extension data.
@ -331,6 +332,13 @@ static int qt_gl_resolve_features()
if (format.majorVersion() >= 3)
features |= QOpenGLFunctions::Framebuffers;
const QPair<int, int> version = format.version();
if (version < qMakePair(3, 0)
|| (version == qMakePair(3, 0) && format.testOption(QSurfaceFormat::DeprecatedFunctions))
|| (version == qMakePair(3, 1) && extensions.match("GL_ARB_compatibility"))
|| (version >= qMakePair(3, 2) && format.profile() == QSurfaceFormat::CompatibilityProfile)) {
features |= QOpenGLFunctions::FixedFunctionPipeline;
}
return features;
#endif
}

View File

@ -199,7 +199,8 @@ public:
Multisample = 0x0400,
StencilSeparate = 0x0800,
NPOTTextures = 0x1000,
NPOTTextureRepeat = 0x2000
NPOTTextureRepeat = 0x2000,
FixedFunctionPipeline = 0x4000
};
Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature)