#include <QApplication>
#include <QDesktopWidget>
#include <QtDebug>
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+#include <QSurfaceFormat>
+#endif
#include <stdio.h>
#include <stdlib.h>
#endif // WIN32
+
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+/*!
+ \brief Set default QSurfaceFormat for an application.
+
+ This application property should be set before a creation of the QApplication.
+*/
+void Qtx::initDefaultSurfaceFormat()
+{
+ // Settings from Paraview:
+ // This piece of code was taken from QVTKOpenGLWidget::defaultFormat() method in
+ // order to avoid dependency of the SALOME_Session_Server on vtk libraries
+ QSurfaceFormat fmt;
+ fmt.setRenderableType(QSurfaceFormat::OpenGL);
+ fmt.setVersion(3, 2);
+ fmt.setProfile(QSurfaceFormat::CoreProfile);
+ fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ fmt.setRedBufferSize(1);
+ fmt.setGreenBufferSize(1);
+ fmt.setBlueBufferSize(1);
+ fmt.setDepthBufferSize(1);
+ fmt.setStencilBufferSize(0);
+ fmt.setAlphaBufferSize(1);
+ fmt.setStereo(false);
+ fmt.setSamples(0);
+
+ // Settings for OCCT viewer window:
+ fmt.setDepthBufferSize(16);
+ fmt.setStencilBufferSize(1);
+ // fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
+
+ QSurfaceFormat::setDefaultFormat(fmt);
+}
+#endif
+
/*!
\class Qtx::CmdLineArgs
\brief Get access to the command line arguments in the C-like manner.
static void* getDisplay();
static Qt::HANDLE getVisual();
#endif
+
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+ static void initDefaultSurfaceFormat();
+#endif
};
#endif
#include <QRegExp>
#include <QString>
#include <QStringList>
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-#include <QSurfaceFormat>
-#endif
#include <stdlib.h>
}
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
- // initialization of the X11 visual on Linux
- QSurfaceFormat format;
- format.setDepthBufferSize(16);
- format.setStencilBufferSize(1);
- format.setProfile(QSurfaceFormat::CompatibilityProfile);
- QSurfaceFormat::setDefaultFormat(format);
+ // RNV: setup the default format:
+ // QSurfaceFormat should be set before creation of QApplication,
+ // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats
+ // (see void Qtx::initDefaultSurfaceFormat()) and set the resultant format here.
+ Qtx::initDefaultSurfaceFormat();
#endif
// add <qtdir>/plugins directory to the pluins search path for image plugins
#include <QWaitCondition>
#include <QRegExp>
#include <QTextStream>
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-#include <QSurfaceFormat>
-#endif
/*! - read arguments, define list of server to launch with their arguments.
* - wait for naming service
// RNV: setup the default format:
// QSurfaceFormat should be set before creation of QApplication,
// so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats
- // (see comments below) and set the resultant format here.
-
- // Settings from Paraview:
- // This piece of code was taken from QVTKOpenGLWidget::defaultFormat() method in
- // order to avoid dependency of the SALOME_Session_Server on vtk libraries
- QSurfaceFormat fmt;
- fmt.setRenderableType(QSurfaceFormat::OpenGL);
- fmt.setVersion(3, 2);
- fmt.setProfile(QSurfaceFormat::CoreProfile);
- fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- fmt.setRedBufferSize(1);
- fmt.setGreenBufferSize(1);
- fmt.setBlueBufferSize(1);
- fmt.setDepthBufferSize(1);
- fmt.setStencilBufferSize(0);
- fmt.setAlphaBufferSize(1);
- fmt.setStereo(false);
- fmt.setSamples(0);
-
- // Settings for OCCT viewer window:
- fmt.setDepthBufferSize(16);
- fmt.setStencilBufferSize(1);
- // fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
-
- QSurfaceFormat::setDefaultFormat(fmt);
+ // (see void Qtx::initDefaultSurfaceFormat()) and set the resultant format here.
+ Qtx::initDefaultSurfaceFormat();
#endif