Search
lxdream.org :: lxdream/src/drivers/video_gl.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_gl.c
changeset 1258:f8a9c0fd2abb
prev1256:a9d29fe74bf3
next1259:8a69f4d0b31d
author nkeynes
date Mon Mar 05 11:41:03 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Small cleanups:
Refactor the post-windowing setup into gl_init_driver() in video_gl.c
Move gl_sl.c into src/drivers and tidy up a bit.
Fix OS X compiling plugins with -mdynamic-no-pic
file annotate diff log raw
1.1 --- a/src/drivers/video_gl.c Sun Mar 04 21:10:12 2012 +1000
1.2 +++ b/src/drivers/video_gl.c Mon Mar 05 11:41:03 2012 +1000
1.3 @@ -252,6 +252,32 @@
1.4 return TRUE;
1.5 }
1.6
1.7 +gboolean gl_init_driver( display_driver_t driver, gboolean need_fbo )
1.8 +{
1.9 + /* Use framebuffer objects if available */
1.10 + if( gl_fbo_is_supported() ) {
1.11 + gl_fbo_init(driver);
1.12 + } else if( need_fbo ) {
1.13 + ERROR( "Framebuffer objects not supported - unable to construct an off-screen buffer" );
1.14 + return FALSE;
1.15 + }
1.16 +
1.17 + /* Use SL shaders if available */
1.18 + gboolean have_shaders = glsl_init(driver);
1.19 +#ifndef HAVE_OPENGL_FIXEDFUNC
1.20 + if( !have_shaders ) { /* Shaders are required if we don't have fixed-functionality */
1.21 + gl_fbo_shutdown();
1.22 + return FALSE;
1.23 + }
1.24 +#endif
1.25 +
1.26 + /* Use vertex arrays, VBOs, etc, if we have them */
1.27 + gl_vbo_init(driver);
1.28 +
1.29 + driver->capabilities.has_gl = TRUE;
1.30 + return TRUE;
1.31 +}
1.32 +
1.33 static gboolean video_gl_init();
1.34
1.35 /**
1.36 @@ -268,13 +294,5 @@
1.37
1.38 static gboolean video_gl_init()
1.39 {
1.40 - if( gl_fbo_is_supported() ) {
1.41 - display_gl_driver.capabilities.has_gl = TRUE;
1.42 - gl_fbo_init(&display_gl_driver);
1.43 - gl_vbo_init(&display_gl_driver);
1.44 - glsl_init(&display_gl_driver);
1.45 - return TRUE;
1.46 - } else {
1.47 - return FALSE;
1.48 - }
1.49 + return gl_init_driver(&display_gl_driver, TRUE);
1.50 }
.