diff --git a/polymer/eduke32/build/include/glbuild.h b/polymer/eduke32/build/include/glbuild.h index 53c0ebe3e..b92033337 100644 --- a/polymer/eduke32/build/include/glbuild.h +++ b/polymer/eduke32/build/include/glbuild.h @@ -319,6 +319,7 @@ extern int32_t (WINAPI * bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMAT extern int32_t (WINAPI * bwglGetPixelFormat)(HDC); extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*); extern BOOL (WINAPI * bwglSwapIntervalEXT)(int32_t); +extern HGLRC (WINAPI * bwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList); #endif //////// glGenTextures/glDeleteTextures debugging //////// diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 729409df4..5911d0320 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -373,7 +373,7 @@ static void polymer_prepareshadows(void); // RENDER TARGETS static void polymer_initrendertargets(int32_t count); // DEBUG OUTPUT -static void polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +void PR_CALLBACK polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); #define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]*5) : (((i+n)%p->vertcount)*5)) diff --git a/polymer/eduke32/build/src/glbuild.c b/polymer/eduke32/build/src/glbuild.c index 12dfec7bc..1a2448d0d 100644 --- a/polymer/eduke32/build/src/glbuild.c +++ b/polymer/eduke32/build/src/glbuild.c @@ -287,6 +287,7 @@ int32_t (WINAPI *bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPT int32_t (WINAPI *bwglGetPixelFormat)(HDC); BOOL (WINAPI *bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR *); BOOL (WINAPI *bwglSwapIntervalEXT)(int32_t); +HGLRC (WINAPI * bwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList); static HANDLE hGLDLL, hGLUDLL; #else @@ -625,6 +626,7 @@ int32_t loadglextensions(void) #ifdef RENDERTYPEWIN bwglSwapIntervalEXT = GETPROCEXTSOFT("wglSwapIntervalEXT"); + bwglCreateContextAttribsARB = GETPROCEXTSOFT("wglCreateContextAttribsARB"); #endif return err; } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index c04708805..4a3310a57 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -5662,7 +5662,7 @@ static void polymer_initrendertargets(int32_t count) } // DEBUG OUTPUT -void polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam) +void PR_CALLBACK polymer_debugoutputcallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam) { UNREFERENCED_PARAMETER(source); UNREFERENCED_PARAMETER(type); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 4ed62e5fb..86fbadf2e 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -2803,6 +2803,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp) } hGLRC = bwglCreateContext(hDC); + if (!hGLRC) { ReleaseOpenGL(); @@ -2817,6 +2818,32 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp) return TRUE; } + loadglextensions(); + + // We should really be checking for the new WGL extension string instead + // Enable this to leverage ARB_debug_output + if (bwglCreateContextAttribsARB && 0) { + HGLRC debuggingContext = hGLRC; + + // This corresponds to WGL_CONTEXT_FLAGS_ARB set to WGL_CONTEXT_DEBUG_BIT_ARB + // I'm too lazy to get a new wglext.h + int attribs[] = { + 0x2094, 0x1, + 0 + }; + + debuggingContext = bwglCreateContextAttribsARB(hDC, NULL, attribs); + + if (debuggingContext) { + bwglDeleteContext(hGLRC); + bwglMakeCurrent(hDC, debuggingContext); + hGLRC = debuggingContext; + + // This should be able to get the ARB_debug_output symbols + loadglextensions(); + } + } + polymost_glreset(); bglEnable(GL_TEXTURE_2D); @@ -3234,10 +3261,6 @@ static BOOL CreateAppWindow(int32_t modenum) } } -#ifdef USE_OPENGL - if (bitspp > 8) loadglextensions(); -#endif - xres = width; yres = height; bpp = bitspp;