#include #include #include #include "client/Utils.h" bool checkAndPrintError(const char* message) { GLenum error = glGetError(); switch(error) { case GL_NO_ERROR: return false; case GL_INVALID_ENUM: std::cout << message << ": an unacceptable value is specified for an enumerated argument.\n"; break; case GL_INVALID_VALUE: std::cout << message << ": a numeric argument is out of range.\n"; break; case GL_INVALID_OPERATION: std::cout << message << ": the specified operation is not allowed in the current state.\n"; break; case GL_INVALID_FRAMEBUFFER_OPERATION: std::cout << message << ": the framebuffer object is not complete.\n"; break; case GL_OUT_OF_MEMORY: std::cout << message << ": there is not enough memory left to execute the command.\n"; break; case GL_STACK_UNDERFLOW: std::cout << message << ": an attempt has been made to perform an operation that would cause an internal stack to underflow.\n"; break; case GL_STACK_OVERFLOW: std::cout << message << ": an attempt has been made to perform an operation that would cause an internal stack to overflow.\n"; break; default: std::cout << message << ": unknown OpenGL error: " << error << "\n"; } return true; } float interpolate(float lag, float from, float to) { return from + lag * (to - from); } void printMatrix(const float* data) { std::cout << "MatrixData\n(\n"; std::cout << std::fixed << std::setprecision(5); for(int i = 0; i < 4; i++) { std::cout << std::setw(15); std::cout << data[i] << ", "; std::cout << std::setw(15); std::cout << data[i + 4] << ", "; std::cout << std::setw(15); std::cout << data[i + 8] << ", "; std::cout << std::setw(15); std::cout << data[i + 12] << "\n"; } std::cout << std::defaultfloat; std::cout << ")\n"; }