NBGraphics restructure
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#ifndef _NB_OPENGL_LOADER
|
||||
#define _NB_OPENGL_LOADER
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
namespace NB {
|
||||
|
||||
static unsigned int __NB_GL_DEBUG_ERROR_CODE__;
|
||||
|
||||
static std::string formatDebugString(const std::string& msg, const std::string& file="", int line=-1) {
|
||||
std::string ret = "";
|
||||
if (file != "") {
|
||||
ret += "In file " + file;
|
||||
if (line >= 0) {
|
||||
ret += " at line " + std::to_string(line);
|
||||
}
|
||||
ret += ":\n\t";
|
||||
}
|
||||
return ret + msg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define NB_GL_DEBUG_THROW(cmd, when) while(NB::__NB_GL_DEBUG_ERROR_CODE__=glGetError()){\
|
||||
std::cout << "[GL ERROR]: " << NB::__NB_GL_DEBUG_ERROR_CODE__;\
|
||||
std::cout << " " << when << " " << cmd << "\n";\
|
||||
}
|
||||
#define NB_GL_DEBUG(cmd) NB_GL_DEBUG_THROW(#cmd, "before"); cmd; NB_GL_DEBUG_THROW(#cmd, "after");
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user