MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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 \
33 namespace ML_OPENGL_NAMESPACE \
34 {
35#endif
36
38#ifndef ML_OPENGL_END_NAMESPACE
39#define ML_OPENGL_END_NAMESPACE }
40#endif
42
43#include <ThirdPartyWarningsDisable.h>
44#include <iostream>
45#include <vector>
46#include <string>
47#include <ThirdPartyWarningsRestore.h>
48
49//---------------Export from DLL----------------------
50// To export classes in this DLL, mark them with the
51// MLOPENGL_EXPORT macro.
52
53#ifdef MLOPENGL_EXPORTS
54#define MLOPENGL_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE
55#else
56#define MLOPENGL_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE
57#endif
58
59//--------------- General Error Posting for OpenInventor and OpenGL modules----------------------
60
61//-----------------------------------------------------------------------------------------------
65//-----------------------------------------------------------------------------------------------
66#ifndef SO_MEVISLAB_ERR_POST
67#define SO_MEVISLAB_ERR_POST(OSTREAM_VAL) \
68 { \
69 std::stringstream stroutVal; \
70 stroutVal << OSTREAM_VAL; \
71 std::string stdStrBuf = stroutVal.str(); \
72 SoDebugError::post(stdStrBuf.c_str(), ""); \
73 }
74#endif
75
76//-----------------------------------------------------------------------------------------------
80//-----------------------------------------------------------------------------------------------
81#ifndef MEVISLAB_CHECK_AND_POST_OPENGL_ERROR
82#define MEVISLAB_CHECK_AND_POST_OPENGL_ERROR(FUNC_NAME) \
83 { \
84 const GLenum err = glGetError(); \
85 if (GL_NO_ERROR != err) { \
86 if (GL_OUT_OF_MEMORY == err) { \
87 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Out of memory error" << std::endl); \
88 } \
89 else if (GL_INVALID_ENUM == err) { \
90 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid enum" << std::endl); \
91 } \
92 else if (GL_INVALID_VALUE == err) { \
93 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid value" << std::endl); \
94 } \
95 else if (GL_INVALID_OPERATION == err) { \
96 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid operation" << std::endl); \
97 } \
98 else if (GL_STACK_OVERFLOW == err) { \
99 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack overflow" << std::endl); \
100 } \
101 else if (GL_STACK_UNDERFLOW == err) { \
102 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack underflow" << std::endl); \
103 } \
104 else { \
105 SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Non standard OpenGL error with id " << err << " detected" << std::endl); \
106 } \
107 } \
108 }
109#endif
110
111#endif