MRPT  2.0.1
opengl_api.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #define GL_GLEXT_PROTOTYPES 1
13 #if !defined(GLEW_STATIC)
14 #define GLEW_STATIC
15 #endif
16 
17 #include <mrpt/config.h>
18 
19 #if MRPT_HAS_OPENGL_GLUT
20 #ifdef _WIN32
21 // WINDOWS:
22 #if defined(_MSC_VER)
23 #pragma warning(disable : 4505)
24 #endif
25 #include <GL/glew.h>
26 #include <windows.h>
27 #endif // _WIN32
28 
29 #ifdef __APPLE__
30 #include <GLUT/glut.h>
31 #include <OpenGL/gl.h>
32 #include <OpenGL/glext.h>
33 // From: https://stackoverflow.com/a/22119409/1631514
34 #define glGenVertexArrays glGenVertexArraysAPPLE
35 #define glBindVertexArray glBindVertexArrayAPPLE
36 #define glDeleteVertexArrays glDeleteVertexArraysAPPLE
37 #else
38 #include <GL/gl.h>
39 #include <GL/glut.h>
40 // gl-ext
41 #ifdef _WIN32
42 #include "glext/glext.h"
43 #else
44 #include <GL/glext.h>
45 #endif
46 #endif
47 
48 /* Jerome Monceaux : bilock@gmail.com
49  * Add inclusion of 3rdparty/freeglut/GL/glut.h
50  * because GLUT_INIT_STATE is detected as undefined
51  * under osx
52  */
53 #ifdef __APPLE__
54 //#include <3rdparty/freeglut/GL/freeglut_std.h>
55 #ifndef GLUT_INIT_STATE
56 #define GLUT_INIT_STATE 0x007C
57 #endif
58 #else
59 #ifdef HAVE_FREEGLUT_EXT_H
60 #include <GL/freeglut_ext.h>
61 #endif
62 #endif
63 
64 namespace mrpt::opengl
65 {
66 void checkOpenGLErr_impl(
67  unsigned int glErrorCode, const char* filename, int lineno);
68 }
69 
70 /** Checks glGetError and throws an exception if an error situation is found
71  */
72 #define CHECK_OPENGL_ERROR() \
73  { \
74  auto openglErr = glGetError(); \
75  if (openglErr != GL_NO_ERROR) \
76  mrpt::opengl::checkOpenGLErr_impl(openglErr, __FILE__, __LINE__); \
77  }
78 
79 #endif // MRPT_HAS_OPENGL_GLUT
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020