Search
lxdream.org :: lxdream :: r112:a3008ac0765a
lxdream 0.9.1
released Jun 29
Download Now
changeset112:a3008ac0765a
parent111:230243c2b520
child113:ce4eb7959d56
authornkeynes
dateThu Mar 16 12:42:28 2006 +0000 (14 years ago)
Use GL to display frames
src/drivers/video_gtk.c
src/drivers/video_x11.c
1.1 --- a/src/drivers/video_gtk.c Thu Mar 16 12:41:59 2006 +0000
1.2 +++ b/src/drivers/video_gtk.c Thu Mar 16 12:42:28 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_gtk.c,v 1.4 2006-03-15 13:16:46 nkeynes Exp $
1.6 + * $Id: video_gtk.c,v 1.5 2006-03-16 12:42:28 nkeynes Exp $
1.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -96,6 +96,8 @@
1.11 char *src = frame->data;
1.12 char *dest = video_img->mem;
1.13
1.14 + return video_glx_display_frame( frame );
1.15 +
1.16 switch( frame->colour_format ) {
1.17 case COLFMT_ARGB1555:
1.18 for( y=0; y < frame->vres; y++ ) {
2.1 --- a/src/drivers/video_x11.c Thu Mar 16 12:41:59 2006 +0000
2.2 +++ b/src/drivers/video_x11.c Thu Mar 16 12:42:28 2006 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: video_x11.c,v 1.3 2006-03-15 13:16:46 nkeynes Exp $
2.6 + * $Id: video_x11.c,v 1.4 2006-03-16 12:42:28 nkeynes Exp $
2.7 *
2.8 * Shared functions for all X11-based display drivers.
2.9 *
2.10 @@ -150,6 +150,39 @@
2.11 return video_glx_create_window( x, y, width, height );
2.12 }
2.13
2.14 +gboolean video_glx_display_frame( video_buffer_t frame )
2.15 +{
2.16 + GLenum type, format = GL_RGB;
2.17 + switch( frame->colour_format ) {
2.18 + case COLFMT_RGB565:
2.19 + type = GL_UNSIGNED_SHORT_5_6_5;
2.20 + break;
2.21 + case COLFMT_RGB888:
2.22 + type = GL_UNSIGNED_BYTE;
2.23 + break;
2.24 + case COLFMT_ARGB1555:
2.25 + type = GL_UNSIGNED_SHORT_5_5_5_1;
2.26 + break;
2.27 + case COLFMT_ARGB8888:
2.28 + format = GL_BGRA;
2.29 + type = GL_UNSIGNED_INT_8_8_8_8_REV;
2.30 + break;
2.31 + }
2.32 + glDrawBuffer( GL_FRONT );
2.33 + glViewport( 0, 0, frame->hres, frame->vres );
2.34 + glMatrixMode(GL_PROJECTION);
2.35 + glLoadIdentity();
2.36 + glOrtho( 0, frame->hres, frame->vres, 0, 0, -65535 );
2.37 + glMatrixMode(GL_MODELVIEW);
2.38 + glLoadIdentity();
2.39 + glRasterPos2i( 0, 0 );
2.40 + glPixelZoom( 1.0f, -1.0f );
2.41 + glDrawPixels( frame->hres, frame->vres, format, type,
2.42 + frame->data );
2.43 + glFlush();
2.44 + return TRUE;
2.45 +}
2.46 +
2.47 void video_glx_swap_buffers( void )
2.48 {
2.49 glXSwapBuffers( video_x11_display, glx_window );
.