From cc5c38b1aaf93157f5558df95383491a6163cc5a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 3 Oct 2020 19:38:53 +0200 Subject: Add puglGetViewHint() This allows retrieving properties of the view that may be needed, such as the actual bit depth (which may vary from the suggested depth provided as a hint). --- pugl/detail/win_gl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pugl/detail/win_gl.c') diff --git a/pugl/detail/win_gl.c b/pugl/detail/win_gl.c index 8cdad76..096c715 100644 --- a/pugl/detail/win_gl.c +++ b/pugl/detail/win_gl.c @@ -108,6 +108,24 @@ puglWinGlConfigure(PuglView* view) { PuglInternals* impl = view->impl; + // Set attributes to default if they are unset + // (There is no GLX_DONT_CARE equivalent on Windows) + if (view->hints[PUGL_DEPTH_BITS] == PUGL_DONT_CARE) { + view->hints[PUGL_DEPTH_BITS] = 0; + } + if (view->hints[PUGL_STENCIL_BITS] == PUGL_DONT_CARE) { + view->hints[PUGL_STENCIL_BITS] = 0; + } + if (view->hints[PUGL_SAMPLES] == PUGL_DONT_CARE) { + view->hints[PUGL_SAMPLES] = 1; + } + if (view->hints[PUGL_DOUBLE_BUFFER] == PUGL_DONT_CARE) { + view->hints[PUGL_DOUBLE_BUFFER] = 1; + } + if (view->hints[PUGL_SWAP_INTERVAL] == PUGL_DONT_CARE) { + view->hints[PUGL_SWAP_INTERVAL] = 1; + } + // clang-format off const int pixelAttrs[] = { WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, -- cgit v1.2.1