Search
lxdream.org :: lxdream/src/drivers/video_gl.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_gl.c
changeset 736:a02d1475ccfd
prev681:1755a126b109
next854:130928a3cdcb
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/drivers/video_gl.c Sun Jun 01 00:47:45 2008 +0000
1.2 +++ b/src/drivers/video_gl.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -55,11 +55,11 @@
1.4 {
1.5 float top, bottom;
1.6 if( inverted ) {
1.7 - top = ((float)height);
1.8 - bottom = 0;
1.9 + top = ((float)height);
1.10 + bottom = 0;
1.11 } else {
1.12 - top = 0;
1.13 - bottom = ((float)height);
1.14 + top = 0;
1.15 + bottom = ((float)height);
1.16 }
1.17
1.18 /* Reset display parameters */
1.19 @@ -71,33 +71,33 @@
1.20 int ah = video_width * 0.75;
1.21
1.22 if( ah > video_height ) {
1.23 - int w = (video_height/0.75);
1.24 - x1 = (video_width - w)/2;
1.25 - x2 -= x1;
1.26 + int w = (video_height/0.75);
1.27 + x1 = (video_width - w)/2;
1.28 + x2 -= x1;
1.29
1.30 - glBegin( GL_QUADS );
1.31 - glVertex2f( 0, 0 );
1.32 - glVertex2f( x1, 0 );
1.33 - glVertex2f( x1, video_height );
1.34 - glVertex2f( 0, video_height);
1.35 - glVertex2f( x2, 0 );
1.36 - glVertex2f( video_width, 0 );
1.37 - glVertex2f( video_width, video_height );
1.38 - glVertex2f( x2, video_height);
1.39 - glEnd();
1.40 + glBegin( GL_QUADS );
1.41 + glVertex2f( 0, 0 );
1.42 + glVertex2f( x1, 0 );
1.43 + glVertex2f( x1, video_height );
1.44 + glVertex2f( 0, video_height);
1.45 + glVertex2f( x2, 0 );
1.46 + glVertex2f( video_width, 0 );
1.47 + glVertex2f( video_width, video_height );
1.48 + glVertex2f( x2, video_height);
1.49 + glEnd();
1.50 } else if( ah < video_height ) {
1.51 - y1 = (video_height - ah)/2;
1.52 - y2 -= y1;
1.53 - glBegin( GL_QUADS );
1.54 - glVertex2f( 0, 0 );
1.55 - glVertex2f( video_width, 0 );
1.56 - glVertex2f( video_width, y1 );
1.57 - glVertex2f( 0, y1 );
1.58 - glVertex2f( 0, y2 );
1.59 - glVertex2f( video_width, y2 );
1.60 - glVertex2f( video_width, video_height );
1.61 - glVertex2f( 0, video_height );
1.62 - glEnd();
1.63 + y1 = (video_height - ah)/2;
1.64 + y2 -= y1;
1.65 + glBegin( GL_QUADS );
1.66 + glVertex2f( 0, 0 );
1.67 + glVertex2f( video_width, 0 );
1.68 + glVertex2f( video_width, y1 );
1.69 + glVertex2f( 0, y1 );
1.70 + glVertex2f( 0, y2 );
1.71 + glVertex2f( video_width, y2 );
1.72 + glVertex2f( video_width, video_height );
1.73 + glVertex2f( 0, video_height );
1.74 + glEnd();
1.75 }
1.76
1.77 /* Render the textured rectangle */
1.78 @@ -128,11 +128,11 @@
1.79 GLenum format = colour_formats[frame->colour_format].format;
1.80 int bpp = colour_formats[frame->colour_format].bpp;
1.81 int rowstride = (frame->rowstride / bpp) - frame->width;
1.82 -
1.83 +
1.84 glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );
1.85 glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );
1.86 glTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, 0,0,
1.87 - frame->width, frame->height, format, type, frame->data );
1.88 + frame->width, frame->height, format, type, frame->data );
1.89 return TRUE;
1.90 }
1.91
1.92 @@ -150,7 +150,7 @@
1.93 * there's only one buffer this needs to be wrapped.
1.94 */
1.95 gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer,
1.96 - int rowstride, int colour_format )
1.97 + int rowstride, int colour_format )
1.98 {
1.99 glFinish();
1.100 GLenum type = colour_formats[colour_format].type;
1.101 @@ -159,7 +159,7 @@
1.102 // int size = line_size * buffer->height;
1.103 int glrowstride = (rowstride / colour_formats[colour_format].bpp) - buffer->width;
1.104 glPixelStorei( GL_PACK_ROW_LENGTH, glrowstride );
1.105 -
1.106 +
1.107 glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );
1.108 return TRUE;
1.109 }
.