Skip to content

Commit

Permalink
Split the GL includes and the internal includes in gl_defs
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Apr 15, 2020
1 parent a469a75 commit 5c236aa
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/common/gl_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,24 @@
#ifndef GL_DEFS_H
#define GL_DEFS_H

#ifdef MESHLAB_USE_GLAD
#include <glad/glad.h>

// Block loading of GLEW
// #define __glew_h__

#else
#include <GL/glew.h>
#endif

#include "mlexception.h"

// This string is searched for by an error handler, so it must be included
// verbatim in all graphics-related errors.
static const char MESHLAB_GL_ERROR_MSG[] =
"OpenGL extension initialization failed";
#ifdef MESHLAB_USE_GLAD

#include <glad/glad.h>

#ifdef MESHLAB_USE_GLAD
static inline bool initializeGLextensions_notThrowing() {
if (!gladLoadGL()) {
qWarning(MESHLAB_GL_ERROR_MSG);
Expand All @@ -54,12 +62,10 @@ static inline void initializeGLextensions() {
// Work around GLEW-specific code in vcglib

#define GLEW_ARB_uniform_buffer_object GLAD_GL_ARB_uniform_buffer_object
#define GLEW_EXT_transform_feedback GLAD_GL_EXT_transform_feedback
#define GLEW_EXT_transform_feedback GLAD_GL_EXT_transform_feedback

#else

#include <GL/glew.h>

static inline bool initializeGLextensions_notThrowing() {
glewExperimental = GL_TRUE;
GLenum err = glewInit();
Expand Down

0 comments on commit 5c236aa

Please sign in to comment.