Go to the documentation of this file.00001
00002 #include <blort/TomGine/tgError.h>
00003 #include <ros/console.h>
00004
00005 GLenum tgCheckError(std::string pre_msg)
00006 {
00007 GLenum error = glGetError();
00008 switch(error){
00009 case GL_NO_ERROR:
00010
00011
00012 break;
00013 case GL_INVALID_ENUM:
00014
00015
00016
00017 ROS_ERROR("%s OpenGL Error: GL_INVALID_ENUM\n", pre_msg.c_str());
00018 break;
00019 case GL_INVALID_VALUE:
00020
00021
00022
00023 ROS_ERROR("%s OpenGL Error: GL_INVALID_VALUE\n", pre_msg.c_str());
00024 break;
00025 case GL_INVALID_OPERATION:
00026
00027
00028
00029 ROS_ERROR("%s OpenGL Error: GL_INVALID_OPERATION\n", pre_msg.c_str());
00030 break;
00031 case GL_INVALID_FRAMEBUFFER_OPERATION:
00032
00033
00034 ROS_ERROR("%s OpenGL Error: GL_INVALID_FRAMEBUFFER_OPERATION\n", pre_msg.c_str());
00035 break;
00036 case GL_OUT_OF_MEMORY:
00037
00038
00039
00040 ROS_ERROR("%s OpenGL Error: GL_OUT_OF_MEMORY\n", pre_msg.c_str());
00041 break;
00042 default:
00043 ROS_ERROR("%s OpenGL Error: unknown\n", pre_msg.c_str());
00044 break;
00045 }
00046 return error;
00047 }
00048
00049 GLenum tgCheckFBError(GLenum target, std::string pre_msg){
00050
00051 GLenum error = glCheckFramebufferStatus(target);
00052
00053 switch(error){
00054 case GL_FRAMEBUFFER_COMPLETE:
00055 break;
00056 case GL_FRAMEBUFFER_UNDEFINED:
00057
00058 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_UNDEFINED\n", pre_msg.c_str());
00059 break;
00060 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
00061
00062 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n", pre_msg.c_str());
00063 break;
00064 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
00065
00066 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n", pre_msg.c_str());
00067 break;
00068 case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
00069
00070
00071 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n", pre_msg.c_str());
00072 break;
00073 case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
00074
00075
00076 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\n", pre_msg.c_str());
00077 break;
00078 case GL_FRAMEBUFFER_UNSUPPORTED:
00079
00080
00081 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_UNSUPPORTED\n", pre_msg.c_str());
00082 break;
00083 case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
00084
00085
00086
00087
00088 ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\n", pre_msg.c_str());
00089 break;
00090 default:
00091 ROS_ERROR("%s OpenGL FBO Error: unknown\n", pre_msg.c_str());
00092 break;
00093 }
00094 return error;
00095 }
00096