<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src</tt></b></td></tr>
<tr><td><tt>drivers/<a href="#file1">video_gdk.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+1</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-1</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr class="alt" style=";" ><td><tt>       /<a href="#file2">video_gl.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+99</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-82</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr><td><tt>       /<a href="#file3">video_gl.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+7</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr class="alt" style=";" ><td><tt>       /<a href="#file4">video_glx.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+1</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr><td><tt>       /<a href="#file5">video_gtk.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+2</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-6</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr class="alt" style=";" ><td><tt>       /<a href="#file6">video_osx.m</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+1</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-4</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr><td><tt>pvr2/<a href="#file7">glrender.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+20</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-36</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr class="alt" style=";" ><td><tt>    /<a href="#file8">glutil.c</a></tt></td><td id="addedalt" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ccf7cc;" align="right">+27</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr><td><tt>    /<a href="#file9">glutil.h</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+3</td><td></td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr class="alt" style=";" ><td><tt>    /<a href="#file10">texcache.c</a></tt></td><td></td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-2</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">8da2f3dad9c0 -> d93175c36387</td></tr>
<tr><td></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+161</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-131</td><td></td></tr>
</table>
<small id="info" style="color: #888888;" >10 modified files</small><br />
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Factor video_width/video_height out into video_gl.c
Convert immediate-mode bits in video_gl.c into a structure for glDrawArray
Move setOrtho into defineOrthoMatrix in glutil.c
Rearrange various GL settings to keep a consistent state
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_gdk.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_gdk.c
+++ lxdream/src/drivers/video_gdk.c
@@ -25,11 +25,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include <GL/osmesa.h>
 #include "lxdream.h"
 #include "display.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "video_gl.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #define MAX_PIXBUF 16
 
 extern GtkWidget *gtk_video_drawable;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-extern int video_width, video_height;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 static render_buffer_t gdk_pixbuf_create_render_buffer( uint32_t width, uint32_t height );
 static void gdk_pixbuf_destroy_render_buffer( render_buffer_t buffer );
</pre></div>
<hr /><a name="file2" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_gl.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_gl.c
+++ lxdream/src/drivers/video_gl.c
@@ -20,28 +20,90 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #include "display.h"
 #include "pvr2/pvr2.h"
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#include "pvr2/glutil.h"
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #include "drivers/video_gl.h"
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-<span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >extern </span>uint32_t video_width, video_height;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+uint32_t video_width, video_height;
+struct video_vertex {
+    float x,y;
+    float u,v;
+    float r,g,b;
+};
+
+static struct video_box_t {
+    float viewMatrix[16];
+    struct video_vertex gap1[4];
+    struct video_vertex gap2[4];
+    struct video_vertex video_view[4];
+    struct video_vertex invert_view[4];
+} video_box;
+
+void gl_set_video_size( uint32_t width, uint32_t height )
+{
+    video_width = width;
+    video_height = height;
+
+    int x1=0,y1=0,x2=video_width,y2=video_height;
+
+    int ah = video_width * 0.75;
+
+    if( ah > video_height ) {
+        int w = (video_height/0.75);
+        x1 = (video_width - w)/2;
+        x2 -= x1;
+        video_box.gap1[0].x = 0; video_box.gap1[0].y = 0;
+        video_box.gap1[1].x = x1; video_box.gap1[1].y = 0;
+        video_box.gap1[2].x = 0; video_box.gap1[2].y = video_height;
+        video_box.gap1[3].x = x2; video_box.gap1[3].y = video_height;
+        video_box.gap2[0].x = x2; video_box.gap2[0].y = 0;
+        video_box.gap2[1].x = video_width; video_box.gap2[1].y = 0;
+        video_box.gap2[2].x = x2; video_box.gap2[2].y = video_height;
+        video_box.gap2[3].x = video_width; video_box.gap2[3].y = video_height;
+    } else if( ah < video_height ) {
+        y1 = (video_height - ah)/2;
+        y2 -= y1;
+
+        video_box.gap1[0].x = 0; video_box.gap1[0].y = 0;
+        video_box.gap1[1].x = video_width; video_box.gap1[1].y = 0;
+        video_box.gap1[2].x = 0; video_box.gap1[2].y = y1;
+        video_box.gap1[3].x = video_width; video_box.gap1[3].y = y1;
+        video_box.gap2[0].x = 0; video_box.gap2[0].y = y2;
+        video_box.gap2[1].x = video_width; video_box.gap2[1].y = y2;
+        video_box.gap2[2].x = 0; video_box.gap2[2].y = video_height;
+        video_box.gap2[3].x = video_width; video_box.gap2[3].y = video_height;
+    }
+
+    video_box.video_view[0].x = x1; video_box.video_view[0].y = y1;
+    video_box.video_view[0].u = 0; video_box.video_view[0].v = 0;
+    video_box.video_view[1].x = x2; video_box.video_view[1].y = y1;
+    video_box.video_view[1].u = 1; video_box.video_view[1].v = 0;
+    video_box.video_view[2].x = x1; video_box.video_view[2].y = y2;
+    video_box.video_view[2].u = 0; video_box.video_view[2].v = 1;
+    video_box.video_view[3].x = x2; video_box.video_view[3].y = y2;
+    video_box.video_view[3].u = 1; video_box.video_view[3].v = 1;
+
+    memcpy( &video_box.invert_view, &video_box.video_view, sizeof(video_box.video_view) );
+    video_box.invert_view[0].v = 1; video_box.invert_view[1].v = 1;
+    video_box.invert_view[2].v = 0; video_box.invert_view[3].v = 0;
+
+    defineOrthoMatrix(video_box.viewMatrix, video_width, video_height, 0, 65535);
+}
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 /**
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * Reset the gl state to simple orthographic projection with 
- * texturing, alpha/depth/scissor/cull tests disabled.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Setup the gl context for writes to the display output.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-void gl_reset_state()
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+void gl_framebuffer_setup()
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glLoadMatrixf(video_box.viewMatrix);
+    glBlendFunc( GL_ONE, GL_ZERO );
+    glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glViewport( 0, 0, video_width, video_height );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    glOrtho( 0, video_width, video_height, 0, 0, 65535 );
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
-    glEnable( GL_BLEND );
-    glDisable( GL_TEXTURE_2D );
-    glDisable( GL_ALPHA_TEST );
-    glDisable( GL_DEPTH_TEST );
-    glDisable( GL_SCISSOR_TEST );
-    glDisable( GL_CULL_FACE );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glVertexPointer(2, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].x);
+    glColorPointer(3, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].r);
+    glTexCoordPointer(2, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].u);
+    glEnableClientState( GL_VERTEX_ARRAY );
+    glEnableClientState( GL_COLOR_ARRAY );
+    glEnableClientState( GL_TEXTURE_COORD_ARRAY );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 void gl_display_render_buffer( render_buffer_t buffer )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -79,72 +141,16 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 void gl_texture_window( int width, int height, int tex_id, gboolean inverted )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    float top, bottom;
-    if( inverted ) {
-        top = 1;
-        bottom = 0;
-    } else {
-        top = 0;
-        bottom = 1;
-    }
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     /* Reset display parameters */
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    gl_reset_state();
-    glColor3f( 0,0,0 );    
-
-    int x1=0,y1=0,x2=video_width,y2=video_height;
-
-    int ah = video_width * 0.75;
-
-    if( ah > video_height ) {
-        int w = (video_height/0.75);
-        x1 = (video_width - w)/2;
-        x2 -= x1;
-
-        glBegin( GL_QUADS );
-        glVertex2f( 0, 0 );
-        glVertex2f( x1, 0 );
-        glVertex2f( x1, video_height );
-        glVertex2f( 0, video_height);
-        glVertex2f( x2, 0 );
-        glVertex2f( video_width, 0 );
-        glVertex2f( video_width, video_height );
-        glVertex2f( x2, video_height);
-        glEnd();
-    } else if( ah < video_height ) {
-        y1 = (video_height - ah)/2;
-        y2 -= y1;
-        glBegin( GL_QUADS );
-        glVertex2f( 0, 0 );
-        glVertex2f( video_width, 0 );
-        glVertex2f( video_width, y1 );
-        glVertex2f( 0, y1 );
-        glVertex2f( 0, y2 );
-        glVertex2f( video_width, y2 );
-        glVertex2f( video_width, video_height );
-        glVertex2f( 0, video_height );
-        glEnd();
-    }
-
-    /* Render the textured rectangle */
-    glEnable( GL_TEXTURE_2D );
-    glBindTexture( GL_TEXTURE_2D, tex_id );
-    glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    gl_framebuffer_setup();
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+    glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
+    glEnable(GL_TEXTURE_2D);
+    glBindTexture(GL_TEXTURE_2D,tex_id);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glEnable( GL_BLEND );
-    glBlendFunc( GL_ONE, GL_ZERO );
-    glBegin( GL_QUADS );
-    glTexCoord2f( 0, top );
-    glVertex2f( x1, y1 );
-    glTexCoord2f( 1, top );
-    glVertex2f( x2, y1 );
-    glTexCoord2f( 1, bottom );
-    glVertex2f( x2, y2 );
-    glTexCoord2f( 0, bottom );
-    glVertex2f( x1, y2 );
-    glEnd();
-    glDisable( GL_TEXTURE_2D );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glDrawArrays(GL_TRIANGLE_STRIP, inverted ? 12 : 8, 4);
+    glDisable(GL_TEXTURE_2D);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glFlush();
 }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -159,14 +165,25 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glBindTexture( GL_TEXTURE_2D, tex_id );
     glTexSubImage2D( GL_TEXTURE_2D, 0, 0,0,
                      frame->width, frame->height, format, type, frame->data );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return TRUE;
 }
 
 void gl_display_blank( uint32_t colour )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    gl_reset_state();
-    glColor3ub( (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF );
-    glRecti(0,0, video_width, video_height );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    /* Set the video_box background colour */
+    video_box.video_view[0].r = ((float)(((colour >> 16) & 0xFF) + 1)) / 256.0;
+    video_box.video_view[0].g = ((float)(((colour >> 8) & 0xFF) + 1)) / 256.0;
+    video_box.video_view[0].b = ((float)((colour & 0xFF) + 1)) / 256.0;
+    memcpy( &video_box.video_view[1].r, &video_box.video_view[0].r, sizeof(float)*3 );
+    memcpy( &video_box.video_view[2].r, &video_box.video_view[0].r, sizeof(float)*3 );
+    memcpy( &video_box.video_view[3].r, &video_box.video_view[0].r, sizeof(float)*3 );
+
+    /* And render */
+    gl_framebuffer_setup();
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+    glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
+    glDrawArrays(GL_TRIANGLE_STRIP, 8, 4);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glFlush();
 }
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -185,7 +202,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     // int size = line_size * buffer->height;
     int glrowstride = (rowstride / colour_formats[colour_format].bpp) - buffer->width;
     glPixelStorei( GL_PACK_ROW_LENGTH, glrowstride );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     return TRUE;
 }
</pre></div>
<hr /><a name="file3" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_gl.h</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_gl.h
+++ lxdream/src/drivers/video_gl.h
@@ -23,6 +23,13 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > extern "C" {
 #endif
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+extern uint32_t video_width, video_height;
+
+/**
+ * Set the video size used by the frame blits
+ */
+void gl_set_video_size( uint32_t width, uint32_t height );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
  * Generic GL routine to draw the given frame buffer into a texture
  */
</pre></div>
<hr /><a name="file4" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_glx.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_glx.c
+++ lxdream/src/drivers/video_glx.c
@@ -402,6 +402,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glRasterPos2f(0.375, frame->height-0.375);
     glPixelZoom( 1.0, 1.0 );
     glDrawPixels( frame->width, frame->height, format, type, frame->data );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glFlush();
 }
 
</pre></div>
<hr /><a name="file5" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_gtk.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_gtk.c
+++ lxdream/src/drivers/video_gtk.c
@@ -117,8 +117,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 
 GtkWidget *gtk_video_drawable = NULL;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int video_width = 640;
-int video_height = 480;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 gboolean video_gtk_init();
 void video_gtk_shutdown();
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -146,8 +144,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 gboolean video_gtk_resize_callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    video_width = event->width;
-    video_height = event->height;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    gl_set_video_size(event->width, event->height);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     pvr2_draw_frame();
     return TRUE;
 }
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -281,8 +278,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         return FALSE;
     }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    video_width = gtk_video_drawable->allocation.width;
-    video_height = gtk_video_drawable->allocation.height;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    gl_set_video_size(gtk_video_drawable->allocation.width, gtk_video_drawable->allocation.height);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > #ifdef HAVE_OSMESA
     video_gdk_init_driver( &display_gtk_driver );
 #else
</pre></div>
<hr /><a name="file6" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>video_osx.m</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/video_osx.m
+++ lxdream/src/drivers/video_osx.m
@@ -53,8 +53,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 
 static NSView *video_view = NULL;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-int video_width = 640;
-int video_height = 480;
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #define MAX_MASK_KEYCODE 128
 
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -122,8 +120,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > {
     NSSize size = [self frame].size;
     if( video_width != size.width || video_height != size.height ) {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        video_width = size.width;
-        video_height = size.height;
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+        gl_set_video_size(size.width, size.height);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         video_nsgl_update();
     }
     pvr2_draw_frame();
</pre></div>
<hr /><a name="file7" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glrender.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glrender.c
+++ lxdream/src/pvr2/glrender.c
@@ -124,9 +124,11 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     CGL_MACRO_CONTEXT = CGLGetCurrentContext();
 #endif
     texcache_gl_init(have_shaders); // Allocate texture IDs
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
+    /* Global settings */
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glDisable( GL_CULL_FACE );
     glEnable( GL_BLEND );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glEnable( GL_DEPTH_TEST );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #ifdef HAVE_OPENGL_CLAMP_COLOR
     if( isGLExtensionSupported("GL_ARB_color_buffer_float") ) {
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -135,7 +137,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 #endif
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+#ifdef HAVE_OPENGL_FIXEDFUNC
+    /* Setup defaults for perspective correction + matrices */
+    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+    glMatrixMode(GL_PROJECTION);
+#endif
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #ifdef HAVE_OPENGL_CLEAR_DEPTHF
     glClearDepthf(0);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -383,43 +392,12 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-/**
- * Define an orthographic projection matrix
- * Note: row-major order
- */
-static void setOrtho( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar )
-{
-    matrix[0] =  2/width;
-    matrix[1] =  0;
-    matrix[2] =  0;
-    matrix[3] =  0;
-
-    matrix[4] =  0;
-    matrix[5] = -2/height;
-    matrix[6] =  0;
-    matrix[7] =  0;
-
-    matrix[8] =  0;
-    matrix[9] =  0;
-    matrix[10]= -2/(zfar-znear);
-    matrix[11]=  0;
-
-    matrix[12]= -1;
-    matrix[13]=  1;
-    matrix[14]= -(zfar+znear)/(zfar-znear);
-    matrix[15]=  1;
-}
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 #ifdef HAVE_OPENGL_FIXEDFUNC
 void pvr2_scene_setup_fixed( GLfloat *viewMatrix )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glLoadMatrixf(viewMatrix);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glEnable( GL_DEPTH_TEST );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     
     glEnable( GL_FOG );
     glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -456,12 +434,14 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glDisable( GL_COLOR_SUM );
     glDisable( GL_FOG );
     glDisable( GL_ALPHA_TEST );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glDisable( GL_DEPTH_TEST );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     glDisableClientState( GL_VERTEX_ARRAY );
     glDisableClientState( GL_COLOR_ARRAY );
     glDisableClientState( GL_TEXTURE_COORD_ARRAY );
     glDisableClientState( GL_SECONDARY_COLOR_ARRAY );
     glDisableClientState( GL_FOG_COORDINATE_ARRAY_EXT );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 #else
 void pvr2_scene_setup_fixed( GLfloat *viewMatrix, float alphaRef )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -477,6 +457,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 void pvr2_scene_setup_shader( GLfloat *viewMatrix )
 {
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glEnable( GL_DEPTH_TEST );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     glsl_use_pvr2_shader();
     glsl_set_pvr2_shader_view_matrix(viewMatrix);
     glsl_set_pvr2_shader_fog_colour1(pvr2_scene.fog_vert_colour);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -493,6 +475,8 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void pvr2_scene_cleanup_shader( )
 {
     glsl_clear_shader();
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+
+    glDisable( GL_DEPTH_TEST );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > }
 
 void pvr2_scene_set_alpha_shader( float alphaRef )
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -535,7 +519,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         clip_bounds[i] = (uint32_t)pvr2_scene.bounds[i];
     }
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >setOrtho</span>(viewMatrix, pvr2_scene.buffer_width, pvr2_scene.buffer_height, -farz, -nearz);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >defineOrthoMatrix</span>(viewMatrix, pvr2_scene.buffer_width, pvr2_scene.buffer_height, -farz, -nearz);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     if( have_shaders ) {
         pvr2_scene_setup_shader(viewMatrix);
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -589,7 +573,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         glStencilMask( 0x01 );
         glDepthFunc( GL_LEQUAL );
         glDepthMask( GL_FALSE );
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-        glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         FOREACH_SEGMENT(segment)
             if( IS_NONEMPTY_TILE_LIST(segment->opaquemod_ptr) ) {
                 CLIP_TO_SEGMENT();
</pre><pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >@@ -609,6 +592,7 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >         CLIP_TO_SEGMENT();
         gl_render_tilelist(segment->opaque_ptr,TRUE);
     END_FOREACH_SEGMENT()
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    glDisable( GL_STENCIL_TEST );
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
     /* Render the punch-out polygons */
     if( have_shaders )
</pre></div>
<hr /><a name="file8" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glutil.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glutil.c
+++ lxdream/src/pvr2/glutil.c
@@ -125,6 +125,33 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > 
 
 /**
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * Define an orthographic projection matrix
+ * Note: row-major order
+ */
+void defineOrthoMatrix( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar )
+{
+    matrix[0] =  2/width;
+    matrix[1] =  0;
+    matrix[2] =  0;
+    matrix[3] =  0;
+
+    matrix[4] =  0;
+    matrix[5] = -2/height;
+    matrix[6] =  0;
+    matrix[7] =  0;
+
+    matrix[8] =  0;
+    matrix[9] =  0;
+    matrix[10]= -2/(zfar-znear);
+    matrix[11]=  0;
+
+    matrix[12]= -1;
+    matrix[13]=  1;
+    matrix[14]= -(zfar+znear)/(zfar-znear);
+    matrix[15]=  1;
+}
+
+/**
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  * Format a GL extension list (or other space-separated string) nicely, and
  * print to the given output stream.
  */
</pre></div>
<hr /><a name="file9" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>glutil.h</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/glutil.h
+++ lxdream/src/pvr2/glutil.h
@@ -128,6 +128,9 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > void glsl_unload_shaders(void);
 void glsl_clear_shader();
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+/* Define an orthographic transform matrix, given the bounding box (assuming origin at 0) */
+void defineOrthoMatrix( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar );
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /* Convenience formatting function for driver use */
 void fprint_extensions( FILE *out, const char *extensions );
 
</pre></div>
<hr /><a name="file10" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/pvr2</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>texcache.c</b></big> <small id="info" style="color: #888888;" >8da2f3dad9c0 -> d93175c36387</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/pvr2/texcache.c
+++ lxdream/src/pvr2/texcache.c
@@ -499,8 +499,6 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     GLint max_filter = GL_LINEAR;
     GLint mipmapfilter = GL_LINEAR_MIPMAP_LINEAR;
 
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
-
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     /* Decode the format parameters */
     switch( tex_format ) {
     case PVR2_TEX_FORMAT_IDX4:
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>