tgError.cpp
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         // No error has been recorded.
00011         // The value of this symbolic constant is guaranteed to be 0.
00012         break;
00013     case GL_INVALID_ENUM:
00014         // An unacceptable value is specified for an enumerated argument.
00015         // The offending command is ignored
00016         // and has no other side effect than to set the error flag.
00017         ROS_ERROR("%s OpenGL Error: GL_INVALID_ENUM\n", pre_msg.c_str());
00018         break;
00019     case GL_INVALID_VALUE:
00020         // A numeric argument is out of range.
00021         // The offending command is ignored
00022         // and has no other side effect than to set the error flag.
00023         ROS_ERROR("%s OpenGL Error: GL_INVALID_VALUE\n", pre_msg.c_str());
00024         break;
00025     case GL_INVALID_OPERATION:
00026         // The specified operation is not allowed in the current state.
00027         // The offending command is ignored
00028         // and has no other side effect than to set the error flag.
00029         ROS_ERROR("%s OpenGL Error: GL_INVALID_OPERATION\n", pre_msg.c_str());
00030         break;
00031     case GL_INVALID_FRAMEBUFFER_OPERATION:
00032         // The framebuffer object is not complete. The offending command
00033         // is ignored and has no other side effect than to set the error flag.
00034         ROS_ERROR("%s OpenGL Error: GL_INVALID_FRAMEBUFFER_OPERATION\n", pre_msg.c_str());
00035         break;
00036     case GL_OUT_OF_MEMORY:
00037         // There is not enough memory left to execute the command.
00038         // The state of the GL is undefined, except for the state of the error flags,
00039         // after this error is recorded.
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         // is returned if target is the default framebuffer, but the default framebuffer does not exist.
00058         ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_UNDEFINED\n", pre_msg.c_str());
00059         break;
00060     case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
00061         // is returned if any of the framebuffer attachment points are framebuffer incomplete.
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         // is returned if the framebuffer does not have at least one image attached to it.
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         // is returned if the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
00070         // is GL_NONE for any color attachment point(s) named by GL_DRAWBUFFERi.
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         // is returned if the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
00075         // is GL_NONE for any color attachment point(s) named by GL_DRAWBUFFERi.
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         // is returned if the combination of internal formats of the attached images violates
00080         // an implementation-dependent set of restrictions.
00081         ROS_ERROR("%s OpenGL FBO Error: GL_FRAMEBUFFER_UNSUPPORTED\n", pre_msg.c_str());
00082         break;
00083     case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
00084         // is returned if the value of GL_RENDERBUFFER_SAMPLES is not the same
00085         // for all attached renderbuffers; if the value of GL_TEXTURE_SAMPLES is the not same for all attached textures;
00086         // or, if the attached images are a mix of renderbuffers and textures, the value of GL_RENDERBUFFER_SAMPLES
00087         // does not match the value of GL_TEXTURE_SAMPLES.
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 


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12