add version of gl debug callback for not-windows

also add note for differing signature, look into why this "works" on
windows and doesnt on linux later.. seems potentially bad
This commit is contained in:
Robin Hübner 2018-12-16 02:07:52 +01:00
parent 84decfb48f
commit d8e79f0658
1 changed files with 37 additions and 16 deletions

View File

@ -29,24 +29,45 @@ struct Window {
SDL_Window* window;
SDL_GLContext context;
extern(Windows) nothrow @nogc
static void openGLCallbackFunction(
GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length, const (GLchar)* message,
void* userParam)
{
version(Windows) {
extern(Windows) nothrow @nogc
static void openGLCallbackFunction(
GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length, const (GLchar)* message,
void* userParam)
{
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
if (severity == GL_DEBUG_SEVERITY_HIGH) {
printf("Aborting...\n");
import core.stdc.stdlib : exit;
exit(-1);
}
if (severity == GL_DEBUG_SEVERITY_HIGH) {
printf("Aborting...\n");
import core.stdc.stdlib : exit;
exit(-1);
}
} // openGLCallbackFunction
} // openGLCallbackFunction
} else {
extern(C) nothrow @nogc
static void openGLCallbackFunction(
GLenum source, GLenum type,
GLuint id, GLenum severity,
GLsizei length, const (GLchar*) message, // TODO: look at why it's GLchar* for non-windows and the other works on windows..
void* userParam)
{
printf("Message: %s \nSource: %s \nType: %s \nID: %d \nSeverity: %s\n\n",
message, to!(char*)(source), to!(char*)(type), id, to!(char*)(severity));
if (severity == GL_DEBUG_SEVERITY_HIGH) {
printf("Aborting...\n");
import core.stdc.stdlib : exit;
exit(-1);
}
} // openGLCallbackFunction
}
void createWindow(int w, int h, const char* title = "Chipd8 Emu") {
assert(w > 0, "window width must be > 0");