From f04badda030f44c738b35106e29f5bec79415cbe Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 11 Mar 2017 18:23:26 +0100 Subject: [PATCH] Qt5OpenGL: at startup determine some basic information about OpenGL setup --- src/Gui/Application.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index b8d286f7a7..953d593617 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -46,7 +46,9 @@ #include #include - +#if defined(HAVE_QT5_OPENGL) +#include +#endif // FreeCAD Base header #include @@ -1560,11 +1562,7 @@ void Application::runApplication(void) if (!QGLPixelBuffer::hasOpenGLPbuffers()) { Base::Console().Log("This system does not support pbuffers\n"); } -#endif -#if defined(HAVE_QT5_OPENGL) - // FIXME: HAVE_QT5_OPENGL -#else QGLFormat::OpenGLVersionFlags version = QGLFormat::openGLVersionFlags (); if (version & QGLFormat::OpenGL_Version_3_0) Base::Console().Log("OpenGL version 3.0 or higher is present\n"); @@ -1619,6 +1617,30 @@ void Application::runApplication(void) if (size >= 16) // must not be lower than this mw.setIconSize(QSize(size,size)); +#if defined(HAVE_QT5_OPENGL) + { + QWindow window; + window.setSurfaceType(QWindow::OpenGLSurface); + window.create(); + + QOpenGLContext context; + if (context.create()) { + context.makeCurrent(&window); + if (!context.functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers)) { + Base::Console().Log("This system does not support framebuffer objects\n"); + } + if (!context.functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures)) { + Base::Console().Log("This system does not support NPOT textures\n"); + } + + int major = context.format().majorVersion(); + int minor = context.format().minorVersion(); + const char* glVersion = reinterpret_cast(glGetString(GL_VERSION)); + Base::Console().Log("OpenGL version is: %d.%d (%s)\n", major, minor, glVersion); + } + } +#endif + // init the Inventor subsystem SoDB::init(); SIM::Coin3D::Quarter::Quarter::init();