Search
lxdream.org :: lxdream/src/drivers/video_glx.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_glx.c
changeset 1251:b8ab59d39756
prev1246:887f7b0ac7f3
next1256:a9d29fe74bf3
author nkeynes
date Sat Mar 03 16:11:28 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Support depth component 16 as well as 24 (add capability flag for the available bits)
Put remaining TODOs inside HAVE_OPENGL_FIXEDFUNC blocks
Add swap-buffer calls for EGL (does not appear to support rendering directly
to front-buffer)
file annotate diff log raw
1.1 --- a/src/drivers/video_glx.c Sat Mar 03 00:17:36 2012 +1000
1.2 +++ b/src/drivers/video_glx.c Sat Mar 03 16:11:28 2012 +1000
1.3 @@ -41,6 +41,7 @@
1.4 static gboolean glx_fbconfig_supported = FALSE;
1.5 static gboolean glx_pbuffer_supported = FALSE;
1.6 static GLuint glx_pbuffer_texture = 0;
1.7 +static int glx_depth_bits = 0;
1.8
1.9 static void video_glx_swap_buffers( void );
1.10 static void video_glx_print_info( FILE *out );
1.11 @@ -119,6 +120,7 @@
1.12 // glx_fbconfig_supported = FALSE;
1.13 if( glx_fbconfig_supported ) {
1.14 int nelem;
1.15 + glx_depth_bits = 24;
1.16 int fb_attribs[] = { GLX_DRAWABLE_TYPE,
1.17 GLX_PBUFFER_BIT|GLX_WINDOW_BIT,
1.18 GLX_RENDER_TYPE, GLX_RGBA_BIT,
1.19 @@ -130,6 +132,7 @@
1.20 if( configs == NULL || nelem == 0 ) {
1.21 /* Try a 16-bit depth buffer and see if it helps */
1.22 fb_attribs[5] = 16;
1.23 + glx_depth_bits = 16;
1.24 configs = glXChooseFBConfig( display, screen, fb_attribs, &nelem );
1.25 if( nelem > 0 ) {
1.26 WARN( "Using a 16-bit depth buffer - expect video glitches" );
1.27 @@ -148,10 +151,12 @@
1.28 }
1.29
1.30 if( !glx_fbconfig_supported ) {
1.31 + glx_depth_bits = 24;
1.32 int attribs[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, 0 };
1.33 glx_visual = glXChooseVisual( display, screen, attribs );
1.34 if( glx_visual == NULL ) {
1.35 /* Try the 16-bit fallback here too */
1.36 + glx_depth_bits = 16;
1.37 attribs[2] = 16;
1.38 glx_visual = glXChooseVisual( display, screen, attribs );
1.39 if( glx_visual != NULL ) {
1.40 @@ -234,6 +239,7 @@
1.41 driver->swap_buffers = video_glx_swap_buffers;
1.42 driver->print_info = video_glx_print_info;
1.43 driver->capabilities.has_gl = TRUE;
1.44 + driver->capabilities.depth_bits = glx_depth_bits;
1.45 if( gl_fbo_is_supported() ) { // First preference
1.46 gl_fbo_init(driver);
1.47 } else if( glx_pbuffer_supported ) {
.