Commit 088454ed 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 22938119, reversing
changes made to ed8a9a65.
parent 02a94b65
......@@ -27,12 +27,17 @@ endif ()
acg_openmp ()
# check for OpenGL and GLUT as our required dependencies
# check for OpenGL, GLEW and GLUT as our required dependencies
find_package (OpenGL)
if (NOT OPENGL_FOUND)
message (FATAL_ERROR "OpengGL not found!")
endif ()
find_package (GLEW)
if (NOT GLEW_FOUND)
message (FATAL_ERROR "GLEW not found!")
endif ()
find_package (GLUT)
if (NOT GLUT_FOUND)
message (FATAL_ERROR "GLUT not found!")
......@@ -48,6 +53,7 @@ set(INCLUDE_DIRS ${OPENMESH_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/ShaderUtils
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR} )
set(ADDITIONAL_LINK_LIBRARIES "" )
......@@ -84,6 +90,7 @@ include_directories (
)
link_directories (
${GLEW_LIBRARY_DIR}
${GLUT_LIBRARY_DIR}
)
......@@ -152,6 +159,7 @@ acg_print_configure_header (ACG "ACG")
target_link_libraries ( ACG ${OPENMESH_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
${ADDITIONAL_LINK_LIBRARIES} )
......
......@@ -126,13 +126,10 @@ MSFilterWeights::MSFilterWeights(int _numSamples) : numSamples_(_numSamples) {
//=============================================================================
#if defined(GL_ARB_texture_buffer_object)
void MSFilterWeights::asTextureBuffer( TextureBuffer& out ) {
if (numSamples_)
out.setBufferData(numSamples_ * 4, &weights_[0], GL_R32F, GL_STATIC_DRAW);
}
#endif
//=============================================================================
......
......@@ -125,6 +125,7 @@ void FBO::del()
void FBO::attachTexture( GLenum _attachment, GLuint _texture, GLuint _level )
{
#ifdef GL_VERSION_3_2
// bind fbo
bind();
......@@ -154,6 +155,9 @@ void FBO::attachTexture( GLenum _attachment, GLuint _texture, GLuint _level )
// track texture id
attachments_[_attachment] = intID;
#else
std::cerr << "error: FBO::attachTexture unsupported - update glew headers and rebuild" << std::endl;
#endif
}
//-----------------------------------------------------------------------------
......
......@@ -47,7 +47,6 @@
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include <ACG/GL/GLFormatInfo.hh>
#include <iostream>
#include <QString>
......@@ -82,6 +81,7 @@ GLFormatInfo::GLFormatInfo( GLenum _internalFormat )
registerFmt(GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 24, 8, 0, 0, UnsignedInt, false);
registerFmt(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 24, 8, 0, 0, UnsignedInt, false);
#ifdef GL_VERSION_3_0
// single channel formats
registerFmt(GL_R8, GL_RED, GL_UNSIGNED_BYTE, 8, 0, 0, 0, UnsignedInt, true);
registerFmt(GL_R8_SNORM, GL_RED, GL_BYTE, 8, 0, 0, 0, SignedInt, true);
......@@ -130,18 +130,19 @@ GLFormatInfo::GLFormatInfo( GLenum _internalFormat )
registerFmt(GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, 32, 32, 32, 32, SignedInt, false);
registerFmt(GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 32, 32, 32, 32, UnsignedInt, false);
registerFmt(GL_RGBA32F, GL_RGBA, GL_FLOAT, 32, 32, 32, 32, FloatingPt, false);
#endif // GL_VERSION_3_0
// depth
registerFmt(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 24, 0, 0, 0, UnsignedInt, false);
registerFmt(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 16, 0, 0, 0, UnsignedInt, false);
#ifdef GL_DEPTH_COMPONENT32F
#ifdef GL_ARB_depth_buffer_float
registerFmt(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, 32, 0, 0, 0, FloatingPt, false);
registerFmt(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 32, 8, -24, 0, FloatingPt, false);
#endif
#endif // GL_ARB_depth_buffer_float
#ifdef GL_STENCIL_INDEX8
#ifdef GL_ARB_texture_stencil8
registerFmt(GL_STENCIL_INDEX8, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, 8, 0, 0, 0, UnsignedInt, false);
#endif
#endif // GL_ARB_texture_stencil8
}
std::map<GLenum, GLFormatInfo>::iterator f = formatMap_.find(_internalFormat);
......
......@@ -1327,7 +1327,7 @@ void GLState::syncFromGL()
GLint getparam;
#ifdef GL_BLEND_SRC_RGB
#ifdef GL_VERSION_1_4
glGetIntegerv(GL_BLEND_SRC_RGB, &getparam);
stateStack_.back().blendFuncState_[0] = getparam;
......@@ -1611,7 +1611,7 @@ void GLState::blendFuncSeparate(GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha
stateStack_.back().blendFuncState_[2] != _srcAlpha || stateStack_.back().blendFuncState_[3] != _dstAlpha)
#endif
{
#ifdef GL_BLEND_SRC_RGB
#ifdef GL_VERSION_1_4
// check if glew has loaded glBlendFuncSeparate already
if (glBlendFuncSeparate)
glBlendFuncSeparate(_srcRGB, _dstRGB, _srcAlpha, _dstAlpha);
......
......@@ -316,7 +316,7 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
p->internalFlags_ = 0;
// precompile shader
#ifdef GL_GEOMETRY_INPUT_TYPE
#ifdef GL_VERSION_3_2
GLSL::Program* shaderProg = ACG::ShaderCache::getInstance()->getProgram(&p->shaderDesc);
#endif
......@@ -324,7 +324,7 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
// check primitive type and geometry shader
if (errorDetectionLevel_ > 1 && p->shaderDesc.geometryTemplateFile.length())
{
#ifdef GL_GEOMETRY_INPUT_TYPE
#ifdef GL_VERSION_3_2
GLint geomInputType = 0;
glGetProgramiv(shaderProg->getProgramId(), GL_GEOMETRY_INPUT_TYPE, &geomInputType);
......
......@@ -188,7 +188,14 @@ void ScreenQuad::intDraw (GLSL::Program* _prog, int _numInstances)
if (_numInstances < 1)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
else
{
#ifdef GL_VERSION_3_1
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, _numInstances);
#else
std::cerr << "error: instanced ScreenQuad draw - outdated glew version" << std::endl;
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
#endif
}
if (_prog)
decl_->deactivateShaderPipeline(_prog);
......
......@@ -62,13 +62,20 @@
#include <cstdlib>
#include <sstream>
#ifndef __APPLE__
#include "gl_compat_4_4.hh"
#else
#include <qgl>
#endif
#if defined(ARCH_DARWIN)
#include <gl/glew.h>
#elif defined(WIN32)
#include <gl/glew.h>
#else // Unix
#include <GL/glew.h>
#endif
//=============================================================================
......
......@@ -69,8 +69,11 @@
#elif defined(WIN32)
#include "acg_glew.hh"
#include <windows.h>
// Dont do this anymore! Use dll version. No problems with plugins and dll
// but a lot with static linking
// # define GLEW_STATIC 1
#include <gl/glew.h>
#include <gl/glut.h>
#else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -47,7 +47,6 @@
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include <ACG/GL/globjects.hh>
#include <ACG/GL/GLFormatInfo.hh>
......
......@@ -1128,8 +1128,7 @@ void QtBaseViewer::initializeGL()
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
//glewInit();
ogl_LoadFunctions();
glewInit();
#endif
......@@ -1243,8 +1242,7 @@ void QtBaseViewer::paintGL()
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
//glewInit();
ogl_LoadFunctions();
glewInit();
#endif
// lock update
......
......@@ -131,12 +131,17 @@ endif()
acg_openmp ()
# check for OpenGL and GLUT as our required dependencies
# check for OpenGL, GLEW and GLUT as our required dependencies
find_package (OpenGL)
if (NOT OPENGL_FOUND)
message (FATAL_ERROR "OpengGL not found!")
endif ()
find_package (GLEW)
if (NOT GLEW_FOUND)
message (FATAL_ERROR "GLEW not found!")
endif ()
find_package (GLUT)
if (NOT GLUT_FOUND)
message (FATAL_ERROR "GLUT not found!")
......
......@@ -2035,7 +2035,7 @@ void Core::showReducedMenuBar(bool reduced) {
}
void Core::finishSplash() {
splash_->finish(coreWidget_);
splash_->finish(coreWidget_);
}
......
......@@ -7,6 +7,7 @@ include_directories (
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
......@@ -28,8 +29,14 @@ if( APPLE )
endforeach ()
link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
else (APPLE)
link_directories (
${GLEW_LIBRARY_DIR}
)
endif(APPLE)
if (WIN32)
......@@ -222,6 +229,7 @@ target_link_libraries (${OPENFLIPPER_PRODUCT_STRING}
OpenFlipperPluginLib
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
${COREAPP_ADDITIONAL_LINK_LIBRARIES}
${OPENFLIPPER_STATIC_PLUGINS}
......
......@@ -446,9 +446,13 @@ int main(int argc, char **argv)
}
}
}
// 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 )
w->commandLineOpen(args.File(i), openPolyMeshes);
......
......@@ -42,12 +42,14 @@ include_directories (
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${ADDITIONAL_PLUGINLIB_INCS}
${PACKAGE_INCLUDES}
)
link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
......@@ -174,6 +176,7 @@ target_link_libraries (OpenFlipperPluginLib
ACG
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
${FTGL_LIBS}
${ADDITIONAL_PLUGINLIB_LIBS}
......
......@@ -16,6 +16,7 @@
# [TRANSLATION_ADDFILES file1 file2 ...]
# [LICENSEMANAGER])
#
# DIRS = additional directories with source files
# DEPS = required dependencies for find_package macro
# OPTDEPS = optional dependencies for find_package macro, if found, a define ENABLE_<Depname> will be added automatically
......@@ -28,6 +29,7 @@
# INCDIRS = additional include directories
# ADDSRC = additional source files
# 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_ADDFILES = additional files that should be included into the translation files
......@@ -70,7 +72,7 @@ endmacro ()
macro (_get_plugin_parameters _prefix)
set (_current_var _foo)
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)
foreach (_val ${_supported_var})
set (${_prefix}_${_val})
......@@ -374,6 +376,26 @@ macro (_plugin_licensemanagement)
endif()
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)
endforeach ()
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
......@@ -460,6 +486,7 @@ function (_build_openflipper_plugin plugin)
${${_PLUGIN}_DEPS_INCDIRS}
${${_PLUGIN}_INCDIRS}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/OpenFlipper/PluginLib
${PACKAGE_INCLUDES}
......
......@@ -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()
......
......@@ -965,3 +965,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