62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
#include "Utility.h"
|
|
|
|
|
|
void APIENTRY Utility::openglCallbackFunction(GLenum source,
|
|
GLenum type,
|
|
GLuint id,
|
|
GLenum severity,
|
|
GLsizei length,
|
|
const GLchar* message,
|
|
const void* userParam){
|
|
std::cout << "---------------------opengl-callback-start------------" << std::endl;
|
|
std::cout << "message: "<< message << std::endl;
|
|
std::cout << "type: ";
|
|
switch (type) {
|
|
case GL_DEBUG_TYPE_ERROR:
|
|
std::cout << "ERROR";
|
|
break;
|
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
|
|
std::cout << "DEPRECATED_BEHAVIOR";
|
|
break;
|
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
|
|
std::cout << "UNDEFINED_BEHAVIOR";
|
|
break;
|
|
case GL_DEBUG_TYPE_PORTABILITY:
|
|
std::cout << "PORTABILITY";
|
|
break;
|
|
case GL_DEBUG_TYPE_PERFORMANCE:
|
|
std::cout << "PERFORMANCE";
|
|
break;
|
|
case GL_DEBUG_TYPE_OTHER:
|
|
std::cout << "OTHER";
|
|
break;
|
|
}
|
|
std::cout << std::endl;
|
|
|
|
std::cout << "id: " << id << std::endl;
|
|
std::cout << "severity: ";
|
|
switch (severity){
|
|
case GL_DEBUG_SEVERITY_LOW:
|
|
std::cout << "LOW";
|
|
break;
|
|
case GL_DEBUG_SEVERITY_MEDIUM:
|
|
std::cout << "MEDIUM";
|
|
break;
|
|
case GL_DEBUG_SEVERITY_HIGH:
|
|
std::cout << "HIGH";
|
|
break;
|
|
}
|
|
std::cout << std::endl;
|
|
std::cout << "---------------------opengl-callback-end--------------" << std::endl;
|
|
}
|
|
static const char* Errornames[] = { "OpenGL", "SDL","GLEW", "Other" };
|
|
void Utility::printWarning(ERROR_TYPE type, std::string msg) {
|
|
std::cout << "Warning[" << Errornames[type] << "]: " << msg << std::endl;
|
|
}
|
|
|
|
void Utility::printError(ERROR_TYPE type, std::string msg) {
|
|
std::cout << "Error[" << Errornames[type] << "]: " << msg << std::endl;
|
|
}
|
|
void Utility::printInfo(ERROR_TYPE type, std::string msg) {
|
|
std::cout << "Info[" << Errornames[type] << "]: " << msg << std::endl;
|
|
} |