Commit aa803cfc authored by Martin Schultz's avatar Martin Schultz

Revert "Merge branch 'newGLLoader' into 'master'

As the new glLoad is not compatible with Qt 5.6 we will continue using
glew for now.

This reverts commit 22938119ac1bcf60ad49078c7fa436856bc7c902, reversing
changes made to ed8a9a65a94b8d72b80133d37ddbf4a8c029988a.
parent 80f89fb7
...@@ -7,6 +7,7 @@ include_directories ( ...@@ -7,6 +7,7 @@ include_directories (
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}
) )
...@@ -28,8 +29,14 @@ if( APPLE ) ...@@ -28,8 +29,14 @@ if( APPLE )
endforeach () endforeach ()
link_directories ( link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS} ${ADDITIONAL_PLUGINLIB_LINK_DIRS}
) )
else (APPLE)
link_directories (
${GLEW_LIBRARY_DIR}
)
endif(APPLE) endif(APPLE)
if (WIN32) if (WIN32)
...@@ -222,6 +229,7 @@ target_link_libraries (${OPENFLIPPER_PRODUCT_STRING} ...@@ -222,6 +229,7 @@ target_link_libraries (${OPENFLIPPER_PRODUCT_STRING}
OpenFlipperPluginLib OpenFlipperPluginLib
${QT_LIBRARIES} ${QT_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES} ${GLUT_LIBRARIES}
${COREAPP_ADDITIONAL_LINK_LIBRARIES} ${COREAPP_ADDITIONAL_LINK_LIBRARIES}
${OPENFLIPPER_STATIC_PLUGINS} ${OPENFLIPPER_STATIC_PLUGINS}
......
...@@ -450,6 +450,10 @@ int main(int argc, char **argv) ...@@ -450,6 +450,10 @@ int main(int argc, char **argv)
// After setting all Options from command line, build the real gui // After setting all Options from command line, build the real gui
w->init(); w->init();
#ifndef __APPLE__
initGlew();
#endif
for ( int i = 0 ; i < args.FileCount(); ++i ) for ( int i = 0 ; i < args.FileCount(); ++i )
w->commandLineOpen(args.File(i), openPolyMeshes); w->commandLineOpen(args.File(i), openPolyMeshes);
......
...@@ -42,12 +42,14 @@ include_directories ( ...@@ -42,12 +42,14 @@ include_directories (
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}
${ADDITIONAL_PLUGINLIB_INCS} ${ADDITIONAL_PLUGINLIB_INCS}
${PACKAGE_INCLUDES} ${PACKAGE_INCLUDES}
) )
link_directories ( link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS} ${ADDITIONAL_PLUGINLIB_LINK_DIRS}
) )
...@@ -174,6 +176,7 @@ target_link_libraries (OpenFlipperPluginLib ...@@ -174,6 +176,7 @@ target_link_libraries (OpenFlipperPluginLib
ACG ACG
${QT_LIBRARIES} ${QT_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES} ${GLUT_LIBRARIES}
${FTGL_LIBS} ${FTGL_LIBS}
${ADDITIONAL_PLUGINLIB_LIBS} ${ADDITIONAL_PLUGINLIB_LIBS}
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# [TRANSLATION_ADDFILES file1 file2 ...] # [TRANSLATION_ADDFILES file1 file2 ...]
# [LICENSEMANAGER]) # [LICENSEMANAGER])
# #
# DIRS = additional directories with source files # DIRS = additional directories with source files
# DEPS = required dependencies for find_package macro # DEPS = required dependencies for find_package macro
# OPTDEPS = optional dependencies for find_package macro, if found, a define ENABLE_<Depname> will be added automatically # OPTDEPS = optional dependencies for find_package macro, if found, a define ENABLE_<Depname> will be added automatically
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
# INCDIRS = additional include directories # INCDIRS = additional include directories
# ADDSRC = additional source files # ADDSRC = additional source files
# INSTALLDATA = directories that will be installed into the openflipper data directory # INSTALLDATA = directories that will be installed into the openflipper data directory
# GLEWDEFINITIONS = Checks glew if it defines the given definitions
# #
# TRANSLATION_LANGUAGES = language codes for translation # TRANSLATION_LANGUAGES = language codes for translation
# TRANSLATION_ADDFILES = additional files that should be included into the translation files # TRANSLATION_ADDFILES = additional files that should be included into the translation files
...@@ -70,7 +72,7 @@ endmacro () ...@@ -70,7 +72,7 @@ endmacro ()
macro (_get_plugin_parameters _prefix) macro (_get_plugin_parameters _prefix)
set (_current_var _foo) set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD
LIBRARIES ADD_CORE_APP_LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA TRANSLATION_LANGUAGES TRANSLATION_ADDFILES) LIBRARIES ADD_CORE_APP_LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA GLEWDEFINITIONS TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_flags LICENSEMANAGER) set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var}) foreach (_val ${_supported_var})
set (${_prefix}_${_val}) set (${_prefix}_${_val})
...@@ -374,6 +376,26 @@ macro (_plugin_licensemanagement) ...@@ -374,6 +376,26 @@ macro (_plugin_licensemanagement)
endif() endif()
endmacro () endmacro ()
#======================================================
# check dependencies in GLEW library
# _prefix : prefix used ( usually the plugin name )
#======================================================
macro (_check_plugin_glew_deps _prefix )
foreach (_extension ${${_prefix}_GLEWDEFINITIONS})
acg_test_glew_definition( ${_extension} ${_prefix}_GLEW_HAS_DEFINITION_${_extension} )
# If the dependency is not found, we disable the plugin
if(NOT ${_prefix}_GLEW_HAS_DEFINITION_${_extension} )
set (${_prefix}_HAS_DEPS FALSE)
acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} GLEW extension ${_extension}")
endif()
endforeach()
endmacro ()
#====================================================== #======================================================
...@@ -416,6 +438,10 @@ function (_build_openflipper_plugin plugin) ...@@ -416,6 +438,10 @@ function (_build_openflipper_plugin plugin)
endforeach () endforeach ()
set_property( GLOBAL PROPERTY GLOBAL_CORE_APP_LIBRARIES ${global_core_app_libraries} ) set_property( GLOBAL PROPERTY GLOBAL_CORE_APP_LIBRARIES ${global_core_app_libraries} )
# CHECK for GLEW definitions
#============================================================================================
_check_plugin_glew_deps (${_PLUGIN})
#============================================================================================ #============================================================================================
# Remember Lib dirs for bundle generation # Remember Lib dirs for bundle generation
...@@ -460,6 +486,7 @@ function (_build_openflipper_plugin plugin) ...@@ -460,6 +486,7 @@ function (_build_openflipper_plugin plugin)
${${_PLUGIN}_DEPS_INCDIRS} ${${_PLUGIN}_DEPS_INCDIRS}
${${_PLUGIN}_INCDIRS} ${${_PLUGIN}_INCDIRS}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib ${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib
${PACKAGE_INCLUDES} ${PACKAGE_INCLUDES}
......
...@@ -48,26 +48,19 @@ ...@@ -48,26 +48,19 @@
\*===========================================================================*/ \*===========================================================================*/
#include "glew_wrappers.hh" #include "glew_wrappers.hh"
#include <ACG/GL/gl_compat_4_4.hh>
#include <GL/glew.h>
#include <stdio.h> #include <stdio.h>
#include <string>
#include <sstream>
DLLEXPORT void initOpenGLFunctions() { DLLEXPORT void initGlew() {
int error = ogl_LoadFunctions(); GLenum err = glewInit();
if(error != ogl_LOAD_SUCCEEDED) if (GLEW_OK != err)
{ {
/* Problem: loading the opengl functions failed, something is seriously wrong. */ /* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error when initializing opengl functions: %d\n",error); fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
} }
} }
DLLEXPORT const char * getOpenGLVersion() { DLLEXPORT const char * getGlewVersion() {
std::string version; return (const char *)glewGetString(GLEW_VERSION);
std::stringstream s;
s << ogl_GetMajorVersion() << "."<<ogl_GetMinorVersion();
version = s.str();
return version.c_str() ;
} }
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <OpenFlipper/common/GlobalDefines.hh> #include <OpenFlipper/common/GlobalDefines.hh>
DLLEXPORT void initOpenGLFunctions(); DLLEXPORT void initGlew();
DLLEXPORT const char * getOpenGLVersion(); DLLEXPORT const char * getGlewVersion();
#endif /* GLEW_WRAPPERS_HH_ */ #endif /* GLEW_WRAPPERS_HH_ */
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <common/glew_wrappers.hh> #include <common/glew_wrappers.hh>
#include "CoreWidget.hh" #include "CoreWidget.hh"
#include <OpenFlipper/common/FileTypes.hh> #include <OpenFlipper/common/FileTypes.hh>
...@@ -593,12 +592,11 @@ void CoreWidget::showAboutWidget( ) { ...@@ -593,12 +592,11 @@ void CoreWidget::showAboutWidget( ) {
#ifndef __APPLE__ #ifndef __APPLE__
aboutWidget_->OpenFlipperAbout->append("\n"); aboutWidget_->OpenFlipperAbout->append("\n");
aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont); aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Specific Info:")); aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont); aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
//TODO: rename this we are not using glew anymore QString glewVersion = QString(getGlewVersion());
QString glewVersion = QString(getOpenGLVersion()); aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Version:\t") + glewVersion);
#endif #endif
// ===================================================================================== // =====================================================================================
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
// -------------------- Qt event Includes // -------------------- Qt event Includes
#include <QGLFormat> #include <QGLFormat>
#include "common/glew_wrappers.hh"
#define WIDGET_HEIGHT 800 #define WIDGET_HEIGHT 800
#define WIDGET_WIDTH 800 #define WIDGET_WIDTH 800
...@@ -250,7 +249,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -250,7 +249,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
#endif #endif
glWidget_ = new QGLWidget(format,0); glWidget_ = new QGLWidget(format,0);
glWidget_->makeCurrent();
PluginFunctions::shareGLWidget (glWidget_); PluginFunctions::shareGLWidget (glWidget_);
glView_ = new QtGLGraphicsView(stackedWidget_); glView_ = new QtGLGraphicsView(stackedWidget_);
...@@ -319,8 +317,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -319,8 +317,6 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
// Create examiner // Create examiner
// ====================================================================== // ======================================================================
initOpenGLFunctions();
// First we analyze the scenegraph // First we analyze the scenegraph
unsigned int maxPases = 1; unsigned int maxPases = 1;
ACG::Vec3d bbmin,bbmax; ACG::Vec3d bbmin,bbmax;
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include <set> #include <set>
#include "OpenFlipper/common/Types.hh" #include "OpenFlipper/common/Types.hh"
#include <OpenFlipper/common/GlobalOptions.hh> #include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh> #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
......
...@@ -110,11 +110,9 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect) ...@@ -110,11 +110,9 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
static bool initialized = false; static bool initialized = false;
if (!initialized) if (!initialized)
{ {
// we use glLoadGen to manage extensions :/ // we use GLEW to manage extensions
// initialize it first // initialize it first
#ifndef __APPLE__ glewInit();
ogl_LoadFunctions(); //maybe replace this with a call to the wrapper function. initOpenGLFunctions()
#endif
for (unsigned int i = 0; i < views_->size (); i++) for (unsigned int i = 0; i < views_->size (); i++)
{ {
views_->at(i)->initializeGL (); views_->at(i)->initializeGL ();
......
...@@ -114,10 +114,10 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re ...@@ -114,10 +114,10 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
if (!initialized_) if (!initialized_)
{ {
// we use glLoadGen to manage extensions // we use GLEW to manage extensions
// initialize it first // initialize it first
#ifndef __APPLE__ #ifndef __APPLE__
ogl_LoadFunctions(); glewInit();
#endif #endif
view_->initializeGL(); view_->initializeGL();
cursorPainter_->initializeGL (); cursorPainter_->initializeGL ();
......
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