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 1251:b8ab59d39756
prev1246:887f7b0ac7f3
next1256:a9d29fe74bf3
author nkeynes
date Sat Mar 03 16:11:28 2012 +1000 (9 years ago)
permissions -rw-r--r--
last change Support depth component 16 as well as 24 (add capability flag for the available bits)
Put remaining TODOs inside HAVE_OPENGL_FIXEDFUNC blocks
Add swap-buffer calls for EGL (does not appear to support rendering directly
to front-buffer)
file annotate diff log raw
1.1 --- a/src/drivers/video_gl.c Sat Mar 03 00:17:36 2012 +1000
1.2 +++ b/src/drivers/video_gl.c Sat Mar 03 16:11:28 2012 +1000
1.3 @@ -44,12 +44,18 @@
1.4 struct video_vertex invert_view[4];
1.5 } video_box;
1.6
1.7 -void gl_set_video_size( uint32_t width, uint32_t height )
1.8 +void gl_set_video_size( uint32_t width, uint32_t height, int flipped )
1.9 {
1.10 video_width = width;
1.11 video_height = height;
1.12
1.13 int x1=0,y1=0,x2=video_width,y2=video_height;
1.14 + int top = 0, bottom = 1;
1.15 +
1.16 + if( flipped ) {
1.17 + top = 1;
1.18 + bottom = 0;
1.19 + }
1.20
1.21 int ah = video_width * 0.75;
1.22
1.23 @@ -80,17 +86,17 @@
1.24 }
1.25
1.26 video_box.video_view[0].x = x1; video_box.video_view[0].y = y1;
1.27 - video_box.video_view[0].u = 0; video_box.video_view[0].v = 0;
1.28 + video_box.video_view[0].u = top; video_box.video_view[0].v = top;
1.29 video_box.video_view[1].x = x2; video_box.video_view[1].y = y1;
1.30 - video_box.video_view[1].u = 1; video_box.video_view[1].v = 0;
1.31 + video_box.video_view[1].u = bottom; video_box.video_view[1].v = top;
1.32 video_box.video_view[2].x = x1; video_box.video_view[2].y = y2;
1.33 - video_box.video_view[2].u = 0; video_box.video_view[2].v = 1;
1.34 + video_box.video_view[2].u = top; video_box.video_view[2].v = bottom;
1.35 video_box.video_view[3].x = x2; video_box.video_view[3].y = y2;
1.36 - video_box.video_view[3].u = 1; video_box.video_view[3].v = 1;
1.37 + video_box.video_view[3].u = bottom; video_box.video_view[3].v = bottom;
1.38
1.39 memcpy( &video_box.invert_view, &video_box.video_view, sizeof(video_box.video_view) );
1.40 - video_box.invert_view[0].v = 1; video_box.invert_view[1].v = 1;
1.41 - video_box.invert_view[2].v = 0; video_box.invert_view[3].v = 0;
1.42 + video_box.invert_view[0].v = bottom; video_box.invert_view[1].v = bottom;
1.43 + video_box.invert_view[2].v = top; video_box.invert_view[3].v = top;
1.44
1.45 defineOrthoMatrix(video_box.viewMatrix, video_width, video_height, 0, 65535);
1.46 }
1.47 @@ -175,6 +181,7 @@
1.48 {
1.49 /* Set video box tex alpha to 1 */
1.50 video_box.video_view[0].a = video_box.video_view[1].a = video_box.video_view[2].a = video_box.video_view[3].a = 1;
1.51 + video_box.invert_view[0].a = video_box.invert_view[1].a = video_box.invert_view[2].a = video_box.invert_view[3].a = 1;
1.52
1.53 /* Reset display parameters */
1.54 gl_framebuffer_setup();
1.55 @@ -186,8 +193,8 @@
1.56 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1.57 glDrawArrays(GL_TRIANGLE_STRIP, inverted ? 12 : 8, 4);
1.58 glDisable(GL_TEXTURE_2D);
1.59 + gl_framebuffer_cleanup();
1.60 glFlush();
1.61 - gl_framebuffer_cleanup();
1.62 }
1.63
1.64 gboolean gl_load_frame_buffer( frame_buffer_t frame, int tex_id )
1.65 @@ -221,8 +228,8 @@
1.66 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
1.67 glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
1.68 glDrawArrays(GL_TRIANGLE_STRIP, 8, 4);
1.69 + gl_framebuffer_cleanup();
1.70 glFlush();
1.71 - gl_framebuffer_cleanup();
1.72 }
1.73
1.74 /**
.