Search
lxdream.org :: lxdream/src/drivers/video_x11.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_x11.c
changeset 405:570d93abb5b7
prev370:3131ba1440fc
next424:421d68e78c46
author nkeynes
date Fri Sep 28 07:24:14 2007 +0000 (15 years ago)
permissions -rw-r--r--
last change Add GLSL loader framework
file annotate diff log raw
1.1 --- a/src/drivers/video_x11.c Sat Sep 08 04:05:35 2007 +0000
1.2 +++ b/src/drivers/video_x11.c Fri Sep 28 07:24:14 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_x11.c,v 1.13 2007-09-08 04:05:35 nkeynes Exp $
1.6 + * $Id: video_x11.c,v 1.14 2007-09-28 07:24:14 nkeynes Exp $
1.7 *
1.8 * Shared functions for all X11-based display drivers.
1.9 *
1.10 @@ -20,6 +20,7 @@
1.11 #include <GL/glx.h>
1.12 #include "dream.h"
1.13 #include "drivers/video_x11.h"
1.14 +#include "drivers/gl_common.h"
1.15
1.16 extern uint32_t video_width, video_height;
1.17
1.18 @@ -30,6 +31,7 @@
1.19 static Display *video_x11_display = NULL;
1.20 static Screen *video_x11_screen = NULL;
1.21 static Window video_x11_window = 0;
1.22 +static gboolean glsl_loaded = FALSE;
1.23
1.24 /**
1.25 * GLX parameters.
1.26 @@ -51,6 +53,17 @@
1.27
1.28 if( gl_fbo_is_supported() ) {
1.29 gl_fbo_init(driver);
1.30 +
1.31 +#ifdef USE_GLSL
1.32 + if( glsl_is_supported() ) {
1.33 + glsl_loaded = glsl_load_shaders( glsl_vertex_shader_src, glsl_fragment_shader_src );
1.34 + if( !glsl_loaded ) {
1.35 + WARN( "Shaders failed to load" );
1.36 + }
1.37 + } else {
1.38 + WARN( "Shaders not supported" );
1.39 + }
1.40 +#endif
1.41 return TRUE;
1.42 } else {
1.43 /* Pbuffers? */
1.44 @@ -138,6 +151,9 @@
1.45
1.46 void video_glx_shutdown()
1.47 {
1.48 + if( glsl_loaded ) {
1.49 + glsl_unload_shaders();
1.50 + }
1.51 if( glx_window != None ) {
1.52 XDestroyWindow( video_x11_display, glx_window );
1.53 XFreeColormap( video_x11_display, win_attrs.colormap );
.