From dd6a9c09695161814d53fc2402178eaab348ca85 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Sep 2019 10:30:31 +0200 Subject: Add support for using a debug OpenGL context --- pugl/detail/win_gl.c | 5 ++++- pugl/detail/x11_gl.c | 3 +++ pugl/pugl.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pugl/detail/win_gl.c b/pugl/detail/win_gl.c index db8fee5..4cbb796 100644 --- a/pugl/detail/win_gl.c +++ b/pugl/detail/win_gl.c @@ -54,6 +54,7 @@ #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 typedef HGLRC (*WglCreateContextAttribs)(HDC, HGLRC, const int*); typedef BOOL (*WglSwapInterval)(int); @@ -190,7 +191,9 @@ puglWinGlCreate(PuglView* view) const int contextAttribs[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, view->hints[PUGL_CONTEXT_VERSION_MAJOR], WGL_CONTEXT_MINOR_VERSION_ARB, view->hints[PUGL_CONTEXT_VERSION_MINOR], - WGL_CONTEXT_PROFILE_MASK_ARB, + WGL_CONTEXT_FLAGS_ARB, (view->hints[PUGL_USE_DEBUG_CONTEXT] + ? WGL_CONTEXT_DEBUG_BIT_ARB + : 0), (view->hints[PUGL_USE_COMPAT_PROFILE] ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB), diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index ea93de2..f5dbe2c 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -119,6 +119,9 @@ puglX11GlCreate(PuglView* view) const int ctx_attrs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, view->hints[PUGL_CONTEXT_VERSION_MAJOR], GLX_CONTEXT_MINOR_VERSION_ARB, view->hints[PUGL_CONTEXT_VERSION_MINOR], + GLX_CONTEXT_FLAGS_ARB, (view->hints[PUGL_USE_DEBUG_CONTEXT] + ? GLX_CONTEXT_DEBUG_BIT_ARB + : 0), GLX_CONTEXT_PROFILE_MASK_ARB, (view->hints[PUGL_USE_COMPAT_PROFILE] ? GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB : GLX_CONTEXT_CORE_PROFILE_BIT_ARB), diff --git a/pugl/pugl.h b/pugl/pugl.h index 9a93511..70d6f42 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -78,6 +78,7 @@ typedef enum { */ typedef enum { PUGL_USE_COMPAT_PROFILE, /**< Use compatible (not core) OpenGL profile */ + PUGL_USE_DEBUG_CONTEXT, /**< True to use a debug OpenGL context */ PUGL_CONTEXT_VERSION_MAJOR, /**< OpenGL context major version */ PUGL_CONTEXT_VERSION_MINOR, /**< OpenGL context minor version */ PUGL_RED_BITS, /**< Number of bits for red channel */ -- cgit v1.2.1