Added IMGUI for debugging
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Desktoplauncher.h"
|
||||
#include "DarkRP2D.h"
|
||||
#include "Utility.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -59,6 +60,9 @@ bool initSDL() {
|
||||
}
|
||||
//Mask deprectated functions
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
#ifndef NDEBUG
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
||||
#endif
|
||||
//Init OpenGL Renderer
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
glcontext = SDL_GL_CreateContext(gWindow);
|
||||
@@ -73,6 +77,42 @@ bool initSDL() {
|
||||
cout << "Init of Glew failed: " << glewGetErrorString(err) << endl;
|
||||
return false;
|
||||
}
|
||||
//Init debug callback function
|
||||
#ifndef NDEBUG
|
||||
if (GLEW_ARB_debug_output) {
|
||||
Utility::printInfo(Utility::GLEW, "Supporting ARB debug output!");
|
||||
}
|
||||
if (GLEW_AMD_debug_output) {
|
||||
Utility::printInfo(Utility::GLEW, "Supporting AMD debug output!");
|
||||
}
|
||||
if (GLEW_KHR_debug) {
|
||||
Utility::printInfo(Utility::GLEW, "Supporting KHR debug output!");
|
||||
}
|
||||
//Print OpenGL version
|
||||
printf("----------------------OpenGL Info----------------------------\n");
|
||||
printf("Glew Version: %s\n", glewGetString(GLEW_VERSION));
|
||||
printf(" Version: %s\n", glGetString(GL_VERSION));
|
||||
printf(" Vendor: %s\n", glGetString(GL_VENDOR));
|
||||
printf(" Renderer: %s\n", glGetString(GL_RENDERER));
|
||||
printf(" Shading: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
printf("----------------------------------------------------------------\n");
|
||||
|
||||
if(glDebugMessageCallback) {
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
Utility::printInfo(Utility::OpenGL, "Register OpenGL debug callback");
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(Utility::openglCallbackFunction, nullptr);
|
||||
GLuint unusedIds = 0;
|
||||
glDebugMessageControl(GL_DONT_CARE,
|
||||
GL_DONT_CARE,
|
||||
GL_DONT_CARE,
|
||||
0,
|
||||
&unusedIds,
|
||||
true);
|
||||
} else {
|
||||
Utility::printWarning(Utility::OpenGL, "glDebugMessageCallback not available");
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user