diff options
author | David Robillard <d@drobilla.net> | 2020-10-03 19:38:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-04 12:51:32 +0200 |
commit | cc5c38b1aaf93157f5558df95383491a6163cc5a (patch) | |
tree | a1b858c00ad84a0479b98247f84e608ac0d62866 /pugl/detail/x11_gl.c | |
parent | 6ca124d3787a901129252a2e26c091da1c1ff455 (diff) | |
download | pugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.tar.gz pugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.tar.bz2 pugl-cc5c38b1aaf93157f5558df95383491a6163cc5a.zip |
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).
Diffstat (limited to 'pugl/detail/x11_gl.c')
-rw-r--r-- | pugl/detail/x11_gl.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index e4a0ea8..228a530 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -71,7 +71,7 @@ puglX11GlConfigure(PuglView* view) GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_SAMPLES, view->hints[PUGL_SAMPLES], + GLX_SAMPLES, puglX11GlHintValue(view->hints[PUGL_SAMPLES]), GLX_RED_SIZE, puglX11GlHintValue(view->hints[PUGL_RED_BITS]), GLX_GREEN_SIZE, puglX11GlHintValue(view->hints[PUGL_GREEN_BITS]), GLX_BLUE_SIZE, puglX11GlHintValue(view->hints[PUGL_BLUE_BITS]), @@ -91,6 +91,23 @@ puglX11GlConfigure(PuglView* view) surface->fb_config = fbc[0]; impl->vi = glXGetVisualFromFBConfig(impl->display, fbc[0]); + view->hints[PUGL_RED_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_RED_SIZE); + view->hints[PUGL_GREEN_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_GREEN_SIZE); + view->hints[PUGL_BLUE_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_BLUE_SIZE); + view->hints[PUGL_ALPHA_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_ALPHA_SIZE); + view->hints[PUGL_DEPTH_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_DEPTH_SIZE); + view->hints[PUGL_STENCIL_BITS] = puglX11GlGetAttrib( + display, fbc[0], GLX_STENCIL_SIZE); + view->hints[PUGL_SAMPLES] = puglX11GlGetAttrib( + display, fbc[0], GLX_SAMPLES); + view->hints[PUGL_DOUBLE_BUFFER] = puglX11GlGetAttrib( + display, fbc[0], GLX_DOUBLEBUFFER); + char msg[128]; snprintf( @@ -182,6 +199,11 @@ puglX11GlCreate(PuglView* view) GLX_DOUBLEBUFFER, &view->hints[PUGL_DOUBLE_BUFFER]); + glXQueryDrawable(display, + impl->win, + GLX_SWAP_INTERVAL_EXT, + (unsigned int*)&view->hints[PUGL_SWAP_INTERVAL]); + return PUGL_SUCCESS; } |