MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 00011 #ifndef __mlOpenGLSystem_H 00012 #define __mlOpenGLSystem_H 00013 00014 //------------------------------------------------------------------------------------ 00016 00017 //------------------------------------------------------------------------------------ 00019 #ifndef ML_OPENGL_NAMESPACE 00020 #define ML_OPENGL_NAMESPACE ml 00021 #endif 00022 00026 #ifndef ML_OPENGL_START_NAMESPACE 00027 #define ML_OPENGL_START_NAMESPACE namespace ML_OPENGL_NAMESPACE { 00028 #endif 00029 00031 #ifndef ML_OPENGL_END_NAMESPACE 00032 #define ML_OPENGL_END_NAMESPACE } 00033 #endif 00034 00035 00036 #include "mlSystemWarningsDisable.h" 00037 #include <iostream> 00038 #include <vector> 00039 #include <string> 00040 #include "mlSystemWarningsRestore.h" 00041 00042 //---------------Export from DLL---------------------- 00043 // To export classes in this DLL, mark them with the 00044 // MLOPENGL_EXPORT macro 00045 00046 #ifdef MLOPENGL_EXPORTS 00047 #define MLOPENGL_EXPORT ML_LIBRARY_EXPORT_ATTRIBUTE 00048 #else 00049 #define MLOPENGL_EXPORT ML_LIBRARY_IMPORT_ATTRIBUTE 00050 #endif 00051 00052 //--------------- General Error Posting for OpenInventor and OpenGL modules---------------------- 00053 00054 //----------------------------------------------------------------------------------------------- 00058 //----------------------------------------------------------------------------------------------- 00059 #ifndef SO_MEVISLAB_ERR_POST 00060 #define SO_MEVISLAB_ERR_POST(OSTREAM_VAL) { \ 00061 std::stringstream stroutVal; \ 00062 stroutVal << OSTREAM_VAL; \ 00063 std::string stdStrBuf = stroutVal.str(); \ 00064 SoDebugError::post(stdStrBuf.c_str(), ""); \ 00065 } 00066 #endif 00067 00068 //----------------------------------------------------------------------------------------------- 00072 //----------------------------------------------------------------------------------------------- 00073 #ifndef MEVISLAB_CHECK_AND_POST_OPENGL_ERROR 00074 #define MEVISLAB_CHECK_AND_POST_OPENGL_ERROR(FUNC_NAME) \ 00075 { \ 00076 const GLenum err = glGetError(); \ 00077 if (GL_NO_ERROR != err){ \ 00078 if (GL_OUT_OF_MEMORY == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Out of memory error" << std::endl); } \ 00079 else if (GL_INVALID_ENUM == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid enum" << std::endl); } \ 00080 else if (GL_INVALID_VALUE == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid value" << std::endl); } \ 00081 else if (GL_INVALID_OPERATION == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Invalid operation" << std::endl); } \ 00082 else if (GL_STACK_OVERFLOW == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack overflow" << std::endl); } \ 00083 else if (GL_STACK_UNDERFLOW == err){ SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Stack underflow" << std::endl); } \ 00084 else { SO_MEVISLAB_ERR_POST(FUNC_NAME << ":Non standard OpenGL error with id " << err << " detected" << std::endl); } \ 00085 } \ 00086 } 00087 #endif 00088 00089 #endif 00090