Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.1.0
-
None
-
Mac Os X 10.8.4
Description
The returned format is always the same as the requested format. So even requesting OpenGL Core profile major 6 minor 6 will result in QOpenGLContext::format() returning a format with Core 6.6 versioning (which of course is incorrect). This also affects QWindow::format() in Qt 5.1.0. (in Qt 5.0 I tested and only the context showed this problem, but the QWindow::format() would always return 2.0 in that case).
// this is in a QWindow derived class
QSurfaceFormat *m_requestedFormat = new QSurfaceFormat;
m_requestedFormat = new QSurfaceFormat;
m_requestedFormat->setDepthBufferSize( 24 );
m_requestedFormat->setMajorVersion( 6 );
m_requestedFormat->setMinorVersion( 3 );
m_requestedFormat->setSamples( 4 );
m_requestedFormat->setProfile( QSurfaceFormat::CoreProfile );
m_context = new QOpenGLContext;
m_context->setFormat( *m_requestedFormat );
m_context->create();
setSurfaceType(OpenGLSurface);
resize( 800, 600 );
setFormat( m_context->format() );
create();
...
//QSurfaceFormat fformat = format();
QSurfaceFormat fformat = m_context->format();
QString ver = fformat.profile() == QSurfaceFormat::NoProfile ? "None" : (fformat.profile() == QSurfaceFormat::CoreProfile ? "Core" : "Compatibility");
qDebug() << "OpenGL version:" << ver+":"<<fformat.majorVersion()<<"."<<fformat.minorVersion();