Commit d3af04a7 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'featureQt5.6Support' into 'master'

Feature qt5.6 support



See merge request !92
parents d739ac88 da097bd9
Pipeline #1770 passed with stage
......@@ -48,26 +48,19 @@
\*===========================================================================*/
#include "glew_wrappers.hh"
#include <ACG/GL/gl_compat_4_4.hh>
#include <GL/glew.h>
#include <stdio.h>
#include <string>
#include <sstream>
DLLEXPORT void initOpenGLFunctions() {
int error = ogl_LoadFunctions();
if(error != ogl_LOAD_SUCCEEDED)
DLLEXPORT void initGlew() {
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: loading the opengl functions failed, something is seriously wrong. */
fprintf(stderr, "Error when initializing opengl functions: %d\n",error);
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
}
DLLEXPORT const char * getOpenGLVersion() {
std::string version;
std::stringstream s;
s << ogl_GetMajorVersion() << "."<<ogl_GetMinorVersion();
version = s.str();
return version.c_str() ;
DLLEXPORT const char * getGlewVersion() {
return (const char *)glewGetString(GLEW_VERSION);
}
......@@ -52,7 +52,7 @@
#include <OpenFlipper/common/GlobalDefines.hh>
DLLEXPORT void initOpenGLFunctions();
DLLEXPORT const char * getOpenGLVersion();
DLLEXPORT void initGlew();
DLLEXPORT const char * getGlewVersion();
#endif /* GLEW_WRAPPERS_HH_ */
......@@ -60,7 +60,6 @@
//== INCLUDES =================================================================
#include <common/glew_wrappers.hh>
#include "CoreWidget.hh"
#include <OpenFlipper/common/FileTypes.hh>
......@@ -593,12 +592,11 @@ void CoreWidget::showAboutWidget( ) {
#ifndef __APPLE__
aboutWidget_->OpenFlipperAbout->append("\n");
aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Specific Info:"));
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
//TODO: rename this we are not using glew anymore
QString glewVersion = QString(getOpenGLVersion());
aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Version:\t") + glewVersion);
QString glewVersion = QString(getGlewVersion());
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
#endif
// =====================================================================================
......
......@@ -72,7 +72,6 @@
// -------------------- Qt event Includes
#include <QGLFormat>
#include "common/glew_wrappers.hh"
#define WIDGET_HEIGHT 800
#define WIDGET_WIDTH 800
......@@ -250,7 +249,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
#endif
glWidget_ = new QGLWidget(format,0);
glWidget_->makeCurrent();
PluginFunctions::shareGLWidget (glWidget_);
glView_ = new QtGLGraphicsView(stackedWidget_);
......@@ -319,8 +317,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
// Create examiner
// ======================================================================
initOpenGLFunctions();
// First we analyze the scenegraph
unsigned int maxPases = 1;
ACG::Vec3d bbmin,bbmax;
......
......@@ -67,7 +67,6 @@
#include <set>
#include "OpenFlipper/common/Types.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
......
......@@ -110,11 +110,9 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
static bool initialized = false;
if (!initialized)
{
// we use glLoadGen to manage extensions :/
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
ogl_LoadFunctions(); //maybe replace this with a call to the wrapper function. initOpenGLFunctions()
#endif
glewInit();
for (unsigned int i = 0; i < views_->size (); i++)
{
views_->at(i)->initializeGL ();
......
......@@ -114,10 +114,10 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
if (!initialized_)
{
// we use glLoadGen to manage extensions
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
ogl_LoadFunctions();
glewInit();
#endif
view_->initializeGL();
cursorPainter_->initializeGL ();
......
......@@ -54,10 +54,6 @@
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#ifndef GL_TEXTURE_RECTANGLE_EXT
#define GL_TEXTURE_RECTANGLE_EXT 0x84F5
#endif
void DepthPeelingPlugin::reloadResources(int _viewerId) {
// called in constructor and resizeEvent()
......
......@@ -260,55 +260,84 @@ macro (acg_qt5)
find_package (Qt5Core QUIET)
#find WINDOWS_SDK to avoid qt error. This must be done BEFORE Qt5Widgets is searched
if (Qt5Core_FOUND AND WIN32)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}")
if ( (QT_VERSION_MAJOR EQUAL 5) AND (QT_VERSION_MINOR LESS 3 OR ( QT_VERSION_MINOR EQUAL 3 AND QT_VERSION_PATCH EQUAL 0 )) ) # for all Qt version > 5.0.0 and < 5.3.1
#glu32.lib is needed by qt5 opengl version. it cannot find it by itself so we help qt
#this block has to be executed, before Qt5Gui is searched, otherwise we will end up with the (not so useful) QT5 error message
set(WINDOWS_SDK_LIBS "COULD_NOT_FOUND" CACHE PATH "Path to the latest windows sdk libs which includes glu32.lib. Used by Qt5.")
if (EXISTS "${WINDOWS_SDK_LIBS}\\glu32.lib")
set (CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${WINDOWS_SDK_LIBS}")
elseif(QT5_INSTALL_PATH_EXISTS) #trying to install qt5. notify about missing sdk before the qt message comes
message(FATAL_ERROR "Could not find glu32.lib. This is necessary for QT5 OpenGL version for windows, spleace specify glu32.lib in WINDOWS_SDK_LIB or install Qt version >= 5.3.1")
if(Qt5Core_FOUND)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}")
#find WINDOWS_SDK to avoid qt error. This must be done BEFORE Qt5Widgets is searched
if (WIN32)
if ( (QT_VERSION_MAJOR EQUAL 5) AND (QT_VERSION_MINOR LESS 3 OR ( QT_VERSION_MINOR EQUAL 3 AND QT_VERSION_PATCH EQUAL 0 )) ) # for all Qt version > 5.0.0 and < 5.3.1
#glu32.lib is needed by qt5 opengl version. it cannot find it by itself so we help qt
#this block has to be executed, before Qt5Gui is searched, otherwise we will end up with the (not so useful) QT5 error message
set(WINDOWS_SDK_LIBS "COULD_NOT_FOUND" CACHE PATH "Path to the latest windows sdk libs which includes glu32.lib. Used by Qt5.")
if (EXISTS "${WINDOWS_SDK_LIBS}\\glu32.lib")
set (CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${WINDOWS_SDK_LIBS}")
elseif(QT5_INSTALL_PATH_EXISTS) #trying to install qt5. notify about missing sdk before the qt message comes
message(FATAL_ERROR "Could not find glu32.lib. This is necessary for QT5 OpenGL version for windows, spleace specify glu32.lib in WINDOWS_SDK_LIB or install Qt version >= 5.3.1")
endif()
endif()
endif()
endif(Qt5Core_FOUND AND WIN32)
find_package (Qt5Declarative QUIET)
find_package (Qt5Widgets QUIET)
find_package (Qt5Gui QUIET)
find_package (Qt5OpenGL QUIET)
find_package (Qt5Network QUIET)
find_package (Qt5Script QUIET)
find_package (Qt5ScriptTools QUIET)
find_package (Qt5Sql QUIET)
find_package (Qt5Xml QUIET)
find_package (Qt5XmlPatterns QUIET)
find_package (Qt5Help QUIET)
find_package (Qt5WebKit QUIET)
find_package (Qt5UiTools QUIET)
find_package (Qt5Concurrent QUIET)
find_package (Qt5PrintSupport QUIET)
find_package (Qt5Svg QUIET)
if (NOT WIN32 AND NOT APPLE)
find_package (Qt5X11Extras QUIET)
endif ()
endif(WIN32)
#do noot look for Webkit and qt declarative on qt version 5.6 or newer
if(${QT_VERSION_MINOR} GREATER 5)
find_package (Qt5Widgets QUIET)
find_package (Qt5Gui QUIET)
find_package (Qt5OpenGL QUIET)
find_package (Qt5Network QUIET)
find_package (Qt5Script QUIET)
find_package (Qt5ScriptTools QUIET)
find_package (Qt5Sql QUIET)
find_package (Qt5Xml QUIET)
find_package (Qt5XmlPatterns QUIET)
find_package (Qt5Help QUIET)
find_package (Qt5UiTools QUIET)
find_package (Qt5Concurrent QUIET)
find_package (Qt5PrintSupport QUIET)
find_package (Qt5Svg QUIET)
elseif(${QT_VERSION_MINOR} GREATER 5)
find_package (Qt5Declarative QUIET)
find_package (Qt5Widgets QUIET)
find_package (Qt5Gui QUIET)
find_package (Qt5OpenGL QUIET)
find_package (Qt5Network QUIET)
find_package (Qt5Script QUIET)
find_package (Qt5ScriptTools QUIET)
find_package (Qt5Sql QUIET)
find_package (Qt5Xml QUIET)
find_package (Qt5XmlPatterns QUIET)
find_package (Qt5Help QUIET)
find_package (Qt5WebKit QUIET)
find_package (Qt5UiTools QUIET)
find_package (Qt5Concurrent QUIET)
find_package (Qt5PrintSupport QUIET)
find_package (Qt5Svg QUIET)
endif(${QT_VERSION_MINOR} GREATER 5)
if (NOT WIN32 AND NOT APPLE)
find_package (Qt5X11Extras QUIET)
endif ()
if (Qt5Core_FOUND AND Qt5Declarative_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5WebKit_FOUND AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
if(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
elseif(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Declarative_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5WebKit_FOUND AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
endif(${QT_VERSION_MINOR} GREATER 5)
endif(Qt5Core_FOUND)
if (QT5_FOUND)
acg_unset_qt_shared_variables(5)
......@@ -965,3 +994,25 @@ function (generate_qhp_file files_loc plugin_name)
endforeach()
endfunction()
function(acg_test_glew_definition _def _out)
include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_INCLUDES ${GLEW_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${GLEW_LIBRARIES})
set(CMAKE_REQUIRED_DEFINITIONS -DCHECKING=${_def})
if(GLEW_FOUND)
if(NOT ${_out})
unset(${_out} CACHE) #clear cache, if previous test failed and try again
endif()
CHECK_CXX_SOURCE_RUNS("
#include <GL/glew.h>
int main()
{
#ifdef ${_def}
return 0;
#else
return 1;
#endif
}"
${_out})
endif()
endfunction()
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