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 335:fb890e1814c0
prev327:00d55a462af3
next352:f0df7a6d4703
author nkeynes
date Sun Jan 28 11:36:00 2007 +0000 (17 years ago)
permissions -rw-r--r--
last change Invalidate palette textures when the palette changes (fixes a few texture
bugs)
Fix odd/even selection in pvr2_display_frame
file annotate diff log raw
1.1 --- a/src/drivers/video_x11.c Thu Jan 25 11:46:35 2007 +0000
1.2 +++ b/src/drivers/video_x11.c Sun Jan 28 11:36:00 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_x11.c,v 1.10 2007-01-25 11:46:35 nkeynes Exp $
1.6 + * $Id: video_x11.c,v 1.11 2007-01-27 12:03:53 nkeynes Exp $
1.7 *
1.8 * Shared functions for all X11-based display drivers.
1.9 *
1.10 @@ -28,7 +28,7 @@
1.11 Display *video_x11_display = NULL;
1.12 Screen *video_x11_screen = NULL;
1.13 Window video_x11_window = 0;
1.14 -
1.15 +extern uint32_t video_width, video_height;
1.16 /**
1.17 * GLX parameters.
1.18 */
1.19 @@ -52,7 +52,7 @@
1.20 GLX_GREEN_SIZE, 4,
1.21 GLX_BLUE_SIZE, 4,
1.22 GLX_ALPHA_SIZE, 4,
1.23 - GLX_DEPTH_SIZE, 16,
1.24 + GLX_DEPTH_SIZE, 24,
1.25 GLX_DOUBLEBUFFER,
1.26 None };
1.27 int screen = XScreenNumberOfScreen(video_x11_screen);
1.28 @@ -154,18 +154,24 @@
1.29 {
1.30 GLenum type = colour_formats[frame->colour_format].type;
1.31 GLenum format = colour_formats[frame->colour_format].format;
1.32 -
1.33 + int bpp = colour_formats[frame->colour_format].bpp;
1.34 +
1.35 glDrawBuffer( GL_FRONT );
1.36 - glViewport( 0, 0, frame->hres, frame->vres );
1.37 + glViewport( 0, 0, video_width, video_height );
1.38 glMatrixMode(GL_PROJECTION);
1.39 glLoadIdentity();
1.40 glOrtho( 0, frame->hres, frame->vres, 0, 0, -65535 );
1.41 glMatrixMode(GL_MODELVIEW);
1.42 glLoadIdentity();
1.43 glRasterPos2i( 0, 0 );
1.44 - glPixelZoom( 1.0f, -1.0f );
1.45 + glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
1.46 + float scale = 480.0 / frame->vres;
1.47 + glPixelZoom( 1.0f, -scale );
1.48 + int rowstride = (frame->rowstride / bpp) - frame->hres;
1.49 + glPixelStorei( GL_PACK_ROW_LENGTH, rowstride );
1.50 glDrawPixels( frame->hres, frame->vres, format, type,
1.51 frame->data );
1.52 + glPopClientAttrib();
1.53 glFlush();
1.54 return TRUE;
1.55 }
.