Commit 5d9bb71d authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED retrocompatibility with VTK6 and VTK7

parent 4a4c47ec
......@@ -32,6 +32,7 @@
// // -- QT stuff
#include <QApplication>
#include <QKeyEvent>
#include <QProcessEnvironment>
// -- VTK stuff
// ---- Interactor
......@@ -95,94 +96,11 @@
#include <QSurfaceFormat>
// On some OpenGL drivers (e.g. Mesa 13), the OpenGL context has to be requested before hand
//#include <QOpenGLContext>
//#include <QGLFormat>
//#include <QDebug>
//#include <QWindow>
static void initialize() {
CAMITK_INFO_ALT("Initializing OpenGL Context...");
/*
auto format = QVTKOpenGLNativeWidget::defaultFormat();
format.setProfile(QSurfaceFormat::CompatibilityProfile);
QSurfaceFormat::setDefaultFormat(format);
*/
CAMITK_TRACE_ALT("Initializing OpenGL Context...");
// needed to ensure appropriate OpenGL context is created for VTK rendering.
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
// recommended: disable multisampling for older version of OpenGL ES
// vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0);
//
// auto defaultFormat = QVTKOpenGLWidget::defaultFormat();
// defaultFormat.setSamples(0);
// QSurfaceFormat::setDefaultFormat(defaultFormat);
//
// #ifdef Q_OS_OSX
// QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
// #endif
//
// QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
}
//
// QGLFormat glFormat;
// glFormat.setVersion(3, 2);
// glFormat.setProfile(QGLFormat::NoProfile);
// glFormat.setSampleBuffers(true);
// glFormat.setDefaultFormat(glFormat);
// glFormat.setSwapInterval(1);
//
// glFormat.setDepthBufferSize(8);
// glFormat.setSamples(8);
// glFormat.setAlphaBufferSize(8);
// glFormat.setStencilBufferSize(8);
// /*QGLWidget widget(glFormat);
// widget.makeCurrent();
// */
// /*
// auto window = windowHandle();
//
// if (window != nullptr) {
// QSurfaceFormat surfaceFormat = window->format();
// surfaceFormat.setDepthBufferSize(8);
// surfaceFormat.setSamples(8);
// surfaceFormat.setAlphaBufferSize(8);
// surfaceFormat.setStencilBufferSize(8);
// //surfaceFormat.setStereo(1);
// window->setFormat(surfaceFormat);
// }
// else {
// qWarning("Can't set surface format: No associated QWindow");
// }
//
// const QGLContext *context = widget.context();
//
// glewExperimental = GL_TRUE;
// if (glewInit() != GLEW_OK) {
// qWarning("Failed to initialize GLEW\n");
// }
// */
//
// QSurfaceFormat surfaceFormat;
// surfaceFormat.setVersion(3,2);
// surfaceFormat.setDepthBufferSize(8);
// surfaceFormat.setSamples(8);
// surfaceFormat.setAlphaBufferSize(8);
// surfaceFormat.setStencilBufferSize(8);
//
// QOpenGLContext context;
// context.setFormat(surfaceFormat);
// context.create();
//
// qDebug() << "Context valid: " << context.isValid();
// qDebug() << "Really used OpenGl: " << context.format().majorVersion() << "." << context.format().minorVersion();
// qDebug() << "OpenGl information: VENDOR: " << (const char*)glGetString(GL_VENDOR);
// qDebug() << " RENDERDER: " << (const char*)glGetString(GL_RENDERER);
// qDebug() << " VERSION: " << (const char*)glGetString(GL_VERSION);
// qDebug() << " GLSL VERSION: " << (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
//
// }
Q_COREAPP_STARTUP_FUNCTION(initialize)
......
......@@ -29,6 +29,8 @@
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkUnsignedCharArray.h>
#include <vtkObjectFactory.h> // for the New macros
// ---- Picking
#include <vtkPicker.h>
#include <vtkAreaPicker.h>
......
Markdown is supported
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