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 112:a3008ac0765a
prev108:565de331ccec
next144:7f0714e89aaa
author nkeynes
date Thu Mar 16 12:42:28 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Use GL to display frames
file annotate diff log raw
1.1 --- a/src/drivers/video_x11.c Wed Mar 15 13:16:50 2006 +0000
1.2 +++ b/src/drivers/video_x11.c Thu Mar 16 12:42:28 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_x11.c,v 1.3 2006-03-15 13:16:46 nkeynes Exp $
1.6 + * $Id: video_x11.c,v 1.4 2006-03-16 12:42:28 nkeynes Exp $
1.7 *
1.8 * Shared functions for all X11-based display drivers.
1.9 *
1.10 @@ -150,6 +150,39 @@
1.11 return video_glx_create_window( x, y, width, height );
1.12 }
1.13
1.14 +gboolean video_glx_display_frame( video_buffer_t frame )
1.15 +{
1.16 + GLenum type, format = GL_RGB;
1.17 + switch( frame->colour_format ) {
1.18 + case COLFMT_RGB565:
1.19 + type = GL_UNSIGNED_SHORT_5_6_5;
1.20 + break;
1.21 + case COLFMT_RGB888:
1.22 + type = GL_UNSIGNED_BYTE;
1.23 + break;
1.24 + case COLFMT_ARGB1555:
1.25 + type = GL_UNSIGNED_SHORT_5_5_5_1;
1.26 + break;
1.27 + case COLFMT_ARGB8888:
1.28 + format = GL_BGRA;
1.29 + type = GL_UNSIGNED_INT_8_8_8_8_REV;
1.30 + break;
1.31 + }
1.32 + glDrawBuffer( GL_FRONT );
1.33 + glViewport( 0, 0, frame->hres, frame->vres );
1.34 + glMatrixMode(GL_PROJECTION);
1.35 + glLoadIdentity();
1.36 + glOrtho( 0, frame->hres, frame->vres, 0, 0, -65535 );
1.37 + glMatrixMode(GL_MODELVIEW);
1.38 + glLoadIdentity();
1.39 + glRasterPos2i( 0, 0 );
1.40 + glPixelZoom( 1.0f, -1.0f );
1.41 + glDrawPixels( frame->hres, frame->vres, format, type,
1.42 + frame->data );
1.43 + glFlush();
1.44 + return TRUE;
1.45 +}
1.46 +
1.47 void video_glx_swap_buffers( void )
1.48 {
1.49 glXSwapBuffers( video_x11_display, glx_window );
.