MeVisLab Toolbox Reference
mlOpenGLSystem.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_OPENGL_SYSTEM_H
14#define ML_OPENGL_SYSTEM_H
15
16
18
19//------------------------------------------------------------------------------------
22//------------------------------------------------------------------------------------
24#ifndef ML_OPENGL_NAMESPACE
25#define ML_OPENGL_NAMESPACE ml
26#endif
27
31#ifndef ML_OPENGL_START_NAMESPACE
32#define ML_OPENGL_START_NAMESPACE namespace ML_OPENGL_NAMESPACE {
33#endif
34
36#ifndef ML_OPENGL_END_NAMESPACE
37#define ML_OPENGL_END_NAMESPACE }
38#endif
40
41#include <ThirdPartyWarningsDisable.h>
42#include <iostream>
43#include <vector>
44#include <string>
45#include <ThirdPartyWarningsRestore.h>
46
47//---------------Export from DLL----------------------
48// To export classes in this DLL, mark them with the
49// MLOPENGL_EXPORT macro
50
51#ifdef MLOPENGL_EXPORTS
52 #define MLOPENGL_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE
53#else
54 #define MLOPENGL_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE
55#endif
56
57//--------------- General Error Posting for OpenInventor and OpenGL modules----------------------
58
59//-----------------------------------------------------------------------------------------------
63//-----------------------------------------------------------------------------------------------
64#ifndef SO_MEVISLAB_ERR_POST
65 #define SO_MEVISLAB_ERR_POST(OSTREAM_VAL) { \
66 std::stringstream stroutVal; \
67 stroutVal << OSTREAM_VAL; \
68 std::string stdStrBuf = stroutVal.str(); \
69 SoDebugError::post(stdStrBuf.c_str(), ""); \
70 }
71#endif
72
73//-----------------------------------------------------------------------------------------------
77//-----------------------------------------------------------------------------------------------
78#ifndef MEVISLAB_CHECK_AND_POST_OPENGL_ERROR
79 #define MEVISLAB_CHECK_AND_POST_OPENGL_ERROR(FUNC_NAME) \
80 { \
81 const GLenum err = glGetError(); \
82 if (GL_NO_ERROR != err){ \
83 if (GL_OUT_OF_MEMORY == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Out of memory error" << std::endl); } \
84 else if (GL_INVALID_ENUM == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid enum" << std::endl); } \
85 else if (GL_INVALID_VALUE == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid value" << std::endl); } \
86 else if (GL_INVALID_OPERATION == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid operation" << std::endl); } \
87 else if (GL_STACK_OVERFLOW == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack overflow" << std::endl); } \
88 else if (GL_STACK_UNDERFLOW == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack underflow" << std::endl); } \
89 else { SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Non standard OpenGL error with id " << err << " detected" << std::endl); } \
90 } \
91 }
92#endif
93
94#endif