Search
lxdream.org :: lxdream :: r1244:6b54ef5ed413
lxdream 0.9.1
released Jun 29
Download Now
changeset1244:6b54ef5ed413
parent1243:7f28eb5b815a
child1245:01e0020adf88
authornkeynes
dateTue Feb 28 18:22:52 2012 +1000 (7 years ago)
Add a GL-only video driver for android usage (since the Java code is
responsible for creating the context)
src/display.c
src/display.h
src/drivers/video_gl.c
1.1 --- a/src/display.c Tue Feb 28 17:32:20 2012 +1000
1.2 +++ b/src/display.c Tue Feb 28 18:22:52 2012 +1000
1.3 @@ -31,7 +31,10 @@
1.4 #ifdef HAVE_COCOA
1.5 &display_osx_driver,
1.6 #endif
1.7 -#endif
1.8 +#endif
1.9 +#ifdef __ANDROID__
1.10 + &display_gl_driver,
1.11 +#endif
1.12 &display_null_driver,
1.13 NULL };
1.14
2.1 --- a/src/display.h Tue Feb 28 17:32:20 2012 +1000
2.2 +++ b/src/display.h Tue Feb 28 18:22:52 2012 +1000
2.3 @@ -281,6 +281,7 @@
2.4
2.5 extern struct display_driver display_gtk_driver;
2.6 extern struct display_driver display_osx_driver;
2.7 +extern struct display_driver display_gl_driver;
2.8 extern struct display_driver display_null_driver;
2.9
2.10 /****************** Input methods **********************/
3.1 --- a/src/drivers/video_gl.c Tue Feb 28 17:32:20 2012 +1000
3.2 +++ b/src/drivers/video_gl.c Tue Feb 28 18:22:52 2012 +1000
3.3 @@ -244,3 +244,29 @@
3.4 glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
3.5 return TRUE;
3.6 }
3.7 +
3.8 +static gboolean video_gl_init();
3.9 +
3.10 +/**
3.11 + * Minimal GL driver (assuming that the GL context is already set up externally)
3.12 + * This requires FBO support (since otherwise we have no way to get a render buffer)
3.13 + */
3.14 +struct display_driver display_gl_driver = {
3.15 + "gl", N_("OpenGL driver"), video_gl_init, NULL,
3.16 + NULL, NULL, NULL,
3.17 + NULL, NULL, NULL, NULL,
3.18 + gl_load_frame_buffer, gl_display_render_buffer, gl_display_blank,
3.19 + NULL, gl_read_render_buffer, NULL, NULL
3.20 +};
3.21 +
3.22 +static gboolean video_gl_init()
3.23 +{
3.24 + if( gl_fbo_is_supported() ) {
3.25 + display_gl_driver.capabilities.has_gl = TRUE;
3.26 + gl_fbo_init(&display_gl_driver);
3.27 + gl_vbo_init(&display_gl_driver);
3.28 + return TRUE;
3.29 + } else {
3.30 + return FALSE;
3.31 + }
3.32 +}
.