Commit 4d9951de authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Bug related to the rendering surface default format fixed.

parent bb15dbe0
......@@ -26,31 +26,35 @@ int UILaunch( int argc, char **argv )
// Launch the Qt GUI.
QApplication::setAttribute( Qt::AA_UseDesktopOpenGL, true );
QApplication::setAttribute( Qt::AA_ShareOpenGLContexts, true );
QApplication a( argc, argv );
QApplication a( argc, argv );
QSurfaceFormat format;
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
format.setAlphaBufferSize(8);
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
format.setRenderableType( QSurfaceFormat::OpenGL ); // OpenGL renderable surface.
format.setProfile( QSurfaceFormat::CompatibilityProfile ); // Ensure compatibility with former OpenGL versions.
format.setVersion( 2, 1 ); // Set the prefered OpenGL version.
format.setSwapBehavior( QSurfaceFormat::DoubleBuffer ); // Enable double buffering.
format.setSamples( 8 ); // Desired # of samples when multi-sampling is enabled.
format.setRedBufferSize ( 8 ); // Red channel size in bits.
format.setGreenBufferSize( 8 ); // Green channel size in bits.
format.setBlueBufferSize ( 8 ); // Blue channel size in bits.
//format.setAlphaBufferSize( 8 ); // Alpha channel size in bits.
format.setDepthBufferSize( 24 ); // Depth buffer channel size in bits.
format.setStencilBufferSize( 8 ); // Stencil buffer size in bits.
format.setSwapInterval( 0 ); // Disable VSync.
QSurfaceFormat::setDefaultFormat( format );
UIMainWindow *mainWin = new UIMainWindowT(); // Use default GUI main window.
mainWin->onInitializingApp();
mainWin->init();
mainWin->show();
int appRetVal = a.exec();
int appRetVal = a.exec();
mainWin->release();
mainWin->onReleasingApp();
delete mainWin;
delete mainWin;
return appRetVal;
return appRetVal;
}
......
......@@ -1046,20 +1046,9 @@ void UIMainWindow::setViewerMode( DisplayDoF mode )
{
if( !m_CurrentViewer )
{
// Set up OpenGL context options.
QSurfaceFormat format;
format.setSamples( 16 );
format.setRenderableType( QSurfaceFormat::OpenGL );
format.setSwapBehavior( QSurfaceFormat::DoubleBuffer );
format.setDepthBufferSize( 24 );
format.setStencilBufferSize( 8 );
format.setVersion( 2, 1 );
format.setProfile( QSurfaceFormat::CompatibilityProfile );
// Create the new viewer.
m_CurrentViewer = new GLViewer( mode, format);
m_CurrentViewer = new GLViewer( mode );
m_CurrentViewer->setUpdateBehavior( QOpenGLWidget::NoPartialUpdate );
setCentralWidget( m_CurrentViewer );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment