Search
lxdream.org :: lxdream :: r1236:d93175c36387
lxdream 0.9.1
released Jun 29
Download Now
changeset1236:d93175c36387
parent1235:8da2f3dad9c0
child1237:377077d10d62
authornkeynes
dateFri Feb 24 21:17:47 2012 +1000 (12 years ago)
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
src/drivers/video_gdk.c
src/drivers/video_gl.c
src/drivers/video_gl.h
src/drivers/video_glx.c
src/drivers/video_gtk.c
src/drivers/video_osx.m
src/pvr2/glrender.c
src/pvr2/glutil.c
src/pvr2/glutil.h
src/pvr2/texcache.c
1.1 --- a/src/drivers/video_gdk.c Fri Feb 24 21:11:58 2012 +1000
1.2 +++ b/src/drivers/video_gdk.c Fri Feb 24 21:17:47 2012 +1000
1.3 @@ -25,11 +25,11 @@
1.4 #include <GL/osmesa.h>
1.5 #include "lxdream.h"
1.6 #include "display.h"
1.7 +#include "video_gl.h"
1.8
1.9 #define MAX_PIXBUF 16
1.10
1.11 extern GtkWidget *gtk_video_drawable;
1.12 -extern int video_width, video_height;
1.13
1.14 static render_buffer_t gdk_pixbuf_create_render_buffer( uint32_t width, uint32_t height );
1.15 static void gdk_pixbuf_destroy_render_buffer( render_buffer_t buffer );
2.1 --- a/src/drivers/video_gl.c Fri Feb 24 21:11:58 2012 +1000
2.2 +++ b/src/drivers/video_gl.c Fri Feb 24 21:17:47 2012 +1000
2.3 @@ -20,28 +20,90 @@
2.4
2.5 #include "display.h"
2.6 #include "pvr2/pvr2.h"
2.7 +#include "pvr2/glutil.h"
2.8 #include "drivers/video_gl.h"
2.9
2.10 -extern uint32_t video_width, video_height;
2.11 +uint32_t video_width, video_height;
2.12 +struct video_vertex {
2.13 + float x,y;
2.14 + float u,v;
2.15 + float r,g,b;
2.16 +};
2.17 +
2.18 +static struct video_box_t {
2.19 + float viewMatrix[16];
2.20 + struct video_vertex gap1[4];
2.21 + struct video_vertex gap2[4];
2.22 + struct video_vertex video_view[4];
2.23 + struct video_vertex invert_view[4];
2.24 +} video_box;
2.25 +
2.26 +void gl_set_video_size( uint32_t width, uint32_t height )
2.27 +{
2.28 + video_width = width;
2.29 + video_height = height;
2.30 +
2.31 + int x1=0,y1=0,x2=video_width,y2=video_height;
2.32 +
2.33 + int ah = video_width * 0.75;
2.34 +
2.35 + if( ah > video_height ) {
2.36 + int w = (video_height/0.75);
2.37 + x1 = (video_width - w)/2;
2.38 + x2 -= x1;
2.39 + video_box.gap1[0].x = 0; video_box.gap1[0].y = 0;
2.40 + video_box.gap1[1].x = x1; video_box.gap1[1].y = 0;
2.41 + video_box.gap1[2].x = 0; video_box.gap1[2].y = video_height;
2.42 + video_box.gap1[3].x = x2; video_box.gap1[3].y = video_height;
2.43 + video_box.gap2[0].x = x2; video_box.gap2[0].y = 0;
2.44 + video_box.gap2[1].x = video_width; video_box.gap2[1].y = 0;
2.45 + video_box.gap2[2].x = x2; video_box.gap2[2].y = video_height;
2.46 + video_box.gap2[3].x = video_width; video_box.gap2[3].y = video_height;
2.47 + } else if( ah < video_height ) {
2.48 + y1 = (video_height - ah)/2;
2.49 + y2 -= y1;
2.50 +
2.51 + video_box.gap1[0].x = 0; video_box.gap1[0].y = 0;
2.52 + video_box.gap1[1].x = video_width; video_box.gap1[1].y = 0;
2.53 + video_box.gap1[2].x = 0; video_box.gap1[2].y = y1;
2.54 + video_box.gap1[3].x = video_width; video_box.gap1[3].y = y1;
2.55 + video_box.gap2[0].x = 0; video_box.gap2[0].y = y2;
2.56 + video_box.gap2[1].x = video_width; video_box.gap2[1].y = y2;
2.57 + video_box.gap2[2].x = 0; video_box.gap2[2].y = video_height;
2.58 + video_box.gap2[3].x = video_width; video_box.gap2[3].y = video_height;
2.59 + }
2.60 +
2.61 + video_box.video_view[0].x = x1; video_box.video_view[0].y = y1;
2.62 + video_box.video_view[0].u = 0; video_box.video_view[0].v = 0;
2.63 + video_box.video_view[1].x = x2; video_box.video_view[1].y = y1;
2.64 + video_box.video_view[1].u = 1; video_box.video_view[1].v = 0;
2.65 + video_box.video_view[2].x = x1; video_box.video_view[2].y = y2;
2.66 + video_box.video_view[2].u = 0; video_box.video_view[2].v = 1;
2.67 + video_box.video_view[3].x = x2; video_box.video_view[3].y = y2;
2.68 + video_box.video_view[3].u = 1; video_box.video_view[3].v = 1;
2.69 +
2.70 + memcpy( &video_box.invert_view, &video_box.video_view, sizeof(video_box.video_view) );
2.71 + video_box.invert_view[0].v = 1; video_box.invert_view[1].v = 1;
2.72 + video_box.invert_view[2].v = 0; video_box.invert_view[3].v = 0;
2.73 +
2.74 + defineOrthoMatrix(video_box.viewMatrix, video_width, video_height, 0, 65535);
2.75 +}
2.76
2.77 /**
2.78 - * Reset the gl state to simple orthographic projection with
2.79 - * texturing, alpha/depth/scissor/cull tests disabled.
2.80 + * Setup the gl context for writes to the display output.
2.81 */
2.82 -void gl_reset_state()
2.83 +void gl_framebuffer_setup()
2.84 {
2.85 + glLoadMatrixf(video_box.viewMatrix);
2.86 + glBlendFunc( GL_ONE, GL_ZERO );
2.87 + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
2.88 glViewport( 0, 0, video_width, video_height );
2.89 - glMatrixMode(GL_PROJECTION);
2.90 - glLoadIdentity();
2.91 - glOrtho( 0, video_width, video_height, 0, 0, 65535 );
2.92 - glMatrixMode(GL_MODELVIEW);
2.93 - glLoadIdentity();
2.94 - glEnable( GL_BLEND );
2.95 - glDisable( GL_TEXTURE_2D );
2.96 - glDisable( GL_ALPHA_TEST );
2.97 - glDisable( GL_DEPTH_TEST );
2.98 - glDisable( GL_SCISSOR_TEST );
2.99 - glDisable( GL_CULL_FACE );
2.100 + glVertexPointer(2, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].x);
2.101 + glColorPointer(3, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].r);
2.102 + glTexCoordPointer(2, GL_FLOAT, sizeof(struct video_vertex), &video_box.gap1[0].u);
2.103 + glEnableClientState( GL_VERTEX_ARRAY );
2.104 + glEnableClientState( GL_COLOR_ARRAY );
2.105 + glEnableClientState( GL_TEXTURE_COORD_ARRAY );
2.106 }
2.107
2.108 void gl_display_render_buffer( render_buffer_t buffer )
2.109 @@ -79,72 +141,16 @@
2.110
2.111 void gl_texture_window( int width, int height, int tex_id, gboolean inverted )
2.112 {
2.113 - float top, bottom;
2.114 - if( inverted ) {
2.115 - top = 1;
2.116 - bottom = 0;
2.117 - } else {
2.118 - top = 0;
2.119 - bottom = 1;
2.120 - }
2.121 -
2.122 /* Reset display parameters */
2.123 - gl_reset_state();
2.124 - glColor3f( 0,0,0 );
2.125 -
2.126 - int x1=0,y1=0,x2=video_width,y2=video_height;
2.127 -
2.128 - int ah = video_width * 0.75;
2.129 -
2.130 - if( ah > video_height ) {
2.131 - int w = (video_height/0.75);
2.132 - x1 = (video_width - w)/2;
2.133 - x2 -= x1;
2.134 -
2.135 - glBegin( GL_QUADS );
2.136 - glVertex2f( 0, 0 );
2.137 - glVertex2f( x1, 0 );
2.138 - glVertex2f( x1, video_height );
2.139 - glVertex2f( 0, video_height);
2.140 - glVertex2f( x2, 0 );
2.141 - glVertex2f( video_width, 0 );
2.142 - glVertex2f( video_width, video_height );
2.143 - glVertex2f( x2, video_height);
2.144 - glEnd();
2.145 - } else if( ah < video_height ) {
2.146 - y1 = (video_height - ah)/2;
2.147 - y2 -= y1;
2.148 - glBegin( GL_QUADS );
2.149 - glVertex2f( 0, 0 );
2.150 - glVertex2f( video_width, 0 );
2.151 - glVertex2f( video_width, y1 );
2.152 - glVertex2f( 0, y1 );
2.153 - glVertex2f( 0, y2 );
2.154 - glVertex2f( video_width, y2 );
2.155 - glVertex2f( video_width, video_height );
2.156 - glVertex2f( 0, video_height );
2.157 - glEnd();
2.158 - }
2.159 -
2.160 - /* Render the textured rectangle */
2.161 - glEnable( GL_TEXTURE_2D );
2.162 - glBindTexture( GL_TEXTURE_2D, tex_id );
2.163 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
2.164 + gl_framebuffer_setup();
2.165 + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2.166 + glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
2.167 + glEnable(GL_TEXTURE_2D);
2.168 + glBindTexture(GL_TEXTURE_2D,tex_id);
2.169 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
2.170 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
2.171 - glEnable( GL_BLEND );
2.172 - glBlendFunc( GL_ONE, GL_ZERO );
2.173 - glBegin( GL_QUADS );
2.174 - glTexCoord2f( 0, top );
2.175 - glVertex2f( x1, y1 );
2.176 - glTexCoord2f( 1, top );
2.177 - glVertex2f( x2, y1 );
2.178 - glTexCoord2f( 1, bottom );
2.179 - glVertex2f( x2, y2 );
2.180 - glTexCoord2f( 0, bottom );
2.181 - glVertex2f( x1, y2 );
2.182 - glEnd();
2.183 - glDisable( GL_TEXTURE_2D );
2.184 + glDrawArrays(GL_TRIANGLE_STRIP, inverted ? 12 : 8, 4);
2.185 + glDisable(GL_TEXTURE_2D);
2.186 glFlush();
2.187 }
2.188
2.189 @@ -159,14 +165,25 @@
2.190 glBindTexture( GL_TEXTURE_2D, tex_id );
2.191 glTexSubImage2D( GL_TEXTURE_2D, 0, 0,0,
2.192 frame->width, frame->height, format, type, frame->data );
2.193 + glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
2.194 return TRUE;
2.195 }
2.196
2.197 void gl_display_blank( uint32_t colour )
2.198 {
2.199 - gl_reset_state();
2.200 - glColor3ub( (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF );
2.201 - glRecti(0,0, video_width, video_height );
2.202 + /* Set the video_box background colour */
2.203 + video_box.video_view[0].r = ((float)(((colour >> 16) & 0xFF) + 1)) / 256.0;
2.204 + video_box.video_view[0].g = ((float)(((colour >> 8) & 0xFF) + 1)) / 256.0;
2.205 + video_box.video_view[0].b = ((float)((colour & 0xFF) + 1)) / 256.0;
2.206 + memcpy( &video_box.video_view[1].r, &video_box.video_view[0].r, sizeof(float)*3 );
2.207 + memcpy( &video_box.video_view[2].r, &video_box.video_view[0].r, sizeof(float)*3 );
2.208 + memcpy( &video_box.video_view[3].r, &video_box.video_view[0].r, sizeof(float)*3 );
2.209 +
2.210 + /* And render */
2.211 + gl_framebuffer_setup();
2.212 + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2.213 + glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
2.214 + glDrawArrays(GL_TRIANGLE_STRIP, 8, 4);
2.215 glFlush();
2.216 }
2.217
2.218 @@ -185,7 +202,7 @@
2.219 // int size = line_size * buffer->height;
2.220 int glrowstride = (rowstride / colour_formats[colour_format].bpp) - buffer->width;
2.221 glPixelStorei( GL_PACK_ROW_LENGTH, glrowstride );
2.222 -
2.223 glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );
2.224 + glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
2.225 return TRUE;
2.226 }
3.1 --- a/src/drivers/video_gl.h Fri Feb 24 21:11:58 2012 +1000
3.2 +++ b/src/drivers/video_gl.h Fri Feb 24 21:17:47 2012 +1000
3.3 @@ -23,6 +23,13 @@
3.4 extern "C" {
3.5 #endif
3.6
3.7 +extern uint32_t video_width, video_height;
3.8 +
3.9 +/**
3.10 + * Set the video size used by the frame blits
3.11 + */
3.12 +void gl_set_video_size( uint32_t width, uint32_t height );
3.13 +
3.14 /**
3.15 * Generic GL routine to draw the given frame buffer into a texture
3.16 */
4.1 --- a/src/drivers/video_glx.c Fri Feb 24 21:11:58 2012 +1000
4.2 +++ b/src/drivers/video_glx.c Fri Feb 24 21:17:47 2012 +1000
4.3 @@ -402,6 +402,7 @@
4.4 glRasterPos2f(0.375, frame->height-0.375);
4.5 glPixelZoom( 1.0, 1.0 );
4.6 glDrawPixels( frame->width, frame->height, format, type, frame->data );
4.7 + glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
4.8 glFlush();
4.9 }
4.10
5.1 --- a/src/drivers/video_gtk.c Fri Feb 24 21:11:58 2012 +1000
5.2 +++ b/src/drivers/video_gtk.c Fri Feb 24 21:17:47 2012 +1000
5.3 @@ -117,8 +117,6 @@
5.4
5.5
5.6 GtkWidget *gtk_video_drawable = NULL;
5.7 -int video_width = 640;
5.8 -int video_height = 480;
5.9
5.10 gboolean video_gtk_init();
5.11 void video_gtk_shutdown();
5.12 @@ -146,8 +144,7 @@
5.13
5.14 gboolean video_gtk_resize_callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data )
5.15 {
5.16 - video_width = event->width;
5.17 - video_height = event->height;
5.18 + gl_set_video_size(event->width, event->height);
5.19 pvr2_draw_frame();
5.20 return TRUE;
5.21 }
5.22 @@ -281,8 +278,7 @@
5.23 return FALSE;
5.24 }
5.25
5.26 - video_width = gtk_video_drawable->allocation.width;
5.27 - video_height = gtk_video_drawable->allocation.height;
5.28 + gl_set_video_size(gtk_video_drawable->allocation.width, gtk_video_drawable->allocation.height);
5.29 #ifdef HAVE_OSMESA
5.30 video_gdk_init_driver( &display_gtk_driver );
5.31 #else
6.1 --- a/src/drivers/video_osx.m Fri Feb 24 21:11:58 2012 +1000
6.2 +++ b/src/drivers/video_osx.m Fri Feb 24 21:17:47 2012 +1000
6.3 @@ -53,8 +53,6 @@
6.4
6.5
6.6 static NSView *video_view = NULL;
6.7 -int video_width = 640;
6.8 -int video_height = 480;
6.9
6.10 #define MAX_MASK_KEYCODE 128
6.11
6.12 @@ -122,8 +120,7 @@
6.13 {
6.14 NSSize size = [self frame].size;
6.15 if( video_width != size.width || video_height != size.height ) {
6.16 - video_width = size.width;
6.17 - video_height = size.height;
6.18 + gl_set_video_size(size.width, size.height);
6.19 video_nsgl_update();
6.20 }
6.21 pvr2_draw_frame();
7.1 --- a/src/pvr2/glrender.c Fri Feb 24 21:11:58 2012 +1000
7.2 +++ b/src/pvr2/glrender.c Fri Feb 24 21:17:47 2012 +1000
7.3 @@ -124,9 +124,11 @@
7.4 CGL_MACRO_CONTEXT = CGLGetCurrentContext();
7.5 #endif
7.6 texcache_gl_init(have_shaders); // Allocate texture IDs
7.7 +
7.8 + /* Global settings */
7.9 glDisable( GL_CULL_FACE );
7.10 glEnable( GL_BLEND );
7.11 - glEnable( GL_DEPTH_TEST );
7.12 + glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
7.13
7.14 #ifdef HAVE_OPENGL_CLAMP_COLOR
7.15 if( isGLExtensionSupported("GL_ARB_color_buffer_float") ) {
7.16 @@ -135,7 +137,14 @@
7.17 }
7.18 #endif
7.19
7.20 - glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
7.21 +#ifdef HAVE_OPENGL_FIXEDFUNC
7.22 + /* Setup defaults for perspective correction + matrices */
7.23 + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
7.24 + glMatrixMode(GL_MODELVIEW);
7.25 + glLoadIdentity();
7.26 + glMatrixMode(GL_PROJECTION);
7.27 +#endif
7.28 +
7.29
7.30 #ifdef HAVE_OPENGL_CLEAR_DEPTHF
7.31 glClearDepthf(0);
7.32 @@ -383,43 +392,12 @@
7.33 }
7.34 }
7.35
7.36 -/**
7.37 - * Define an orthographic projection matrix
7.38 - * Note: row-major order
7.39 - */
7.40 -static void setOrtho( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar )
7.41 -{
7.42 - matrix[0] = 2/width;
7.43 - matrix[1] = 0;
7.44 - matrix[2] = 0;
7.45 - matrix[3] = 0;
7.46 -
7.47 - matrix[4] = 0;
7.48 - matrix[5] = -2/height;
7.49 - matrix[6] = 0;
7.50 - matrix[7] = 0;
7.51 -
7.52 - matrix[8] = 0;
7.53 - matrix[9] = 0;
7.54 - matrix[10]= -2/(zfar-znear);
7.55 - matrix[11]= 0;
7.56 -
7.57 - matrix[12]= -1;
7.58 - matrix[13]= 1;
7.59 - matrix[14]= -(zfar+znear)/(zfar-znear);
7.60 - matrix[15]= 1;
7.61 -}
7.62
7.63 #ifdef HAVE_OPENGL_FIXEDFUNC
7.64 void pvr2_scene_setup_fixed( GLfloat *viewMatrix )
7.65 {
7.66 - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
7.67 -
7.68 - glMatrixMode(GL_MODELVIEW);
7.69 - glLoadIdentity();
7.70 - glMatrixMode(GL_PROJECTION);
7.71 - glLoadIdentity();
7.72 glLoadMatrixf(viewMatrix);
7.73 + glEnable( GL_DEPTH_TEST );
7.74
7.75 glEnable( GL_FOG );
7.76 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
7.77 @@ -456,12 +434,14 @@
7.78 glDisable( GL_COLOR_SUM );
7.79 glDisable( GL_FOG );
7.80 glDisable( GL_ALPHA_TEST );
7.81 + glDisable( GL_DEPTH_TEST );
7.82
7.83 glDisableClientState( GL_VERTEX_ARRAY );
7.84 glDisableClientState( GL_COLOR_ARRAY );
7.85 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
7.86 glDisableClientState( GL_SECONDARY_COLOR_ARRAY );
7.87 glDisableClientState( GL_FOG_COORDINATE_ARRAY_EXT );
7.88 +
7.89 }
7.90 #else
7.91 void pvr2_scene_setup_fixed( GLfloat *viewMatrix, float alphaRef )
7.92 @@ -477,6 +457,8 @@
7.93
7.94 void pvr2_scene_setup_shader( GLfloat *viewMatrix )
7.95 {
7.96 + glEnable( GL_DEPTH_TEST );
7.97 +
7.98 glsl_use_pvr2_shader();
7.99 glsl_set_pvr2_shader_view_matrix(viewMatrix);
7.100 glsl_set_pvr2_shader_fog_colour1(pvr2_scene.fog_vert_colour);
7.101 @@ -493,6 +475,8 @@
7.102 void pvr2_scene_cleanup_shader( )
7.103 {
7.104 glsl_clear_shader();
7.105 +
7.106 + glDisable( GL_DEPTH_TEST );
7.107 }
7.108
7.109 void pvr2_scene_set_alpha_shader( float alphaRef )
7.110 @@ -535,7 +519,7 @@
7.111 clip_bounds[i] = (uint32_t)pvr2_scene.bounds[i];
7.112 }
7.113
7.114 - setOrtho(viewMatrix, pvr2_scene.buffer_width, pvr2_scene.buffer_height, -farz, -nearz);
7.115 + defineOrthoMatrix(viewMatrix, pvr2_scene.buffer_width, pvr2_scene.buffer_height, -farz, -nearz);
7.116
7.117 if( have_shaders ) {
7.118 pvr2_scene_setup_shader(viewMatrix);
7.119 @@ -589,7 +573,6 @@
7.120 glStencilMask( 0x01 );
7.121 glDepthFunc( GL_LEQUAL );
7.122 glDepthMask( GL_FALSE );
7.123 - glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
7.124 FOREACH_SEGMENT(segment)
7.125 if( IS_NONEMPTY_TILE_LIST(segment->opaquemod_ptr) ) {
7.126 CLIP_TO_SEGMENT();
7.127 @@ -609,6 +592,7 @@
7.128 CLIP_TO_SEGMENT();
7.129 gl_render_tilelist(segment->opaque_ptr,TRUE);
7.130 END_FOREACH_SEGMENT()
7.131 + glDisable( GL_STENCIL_TEST );
7.132
7.133 /* Render the punch-out polygons */
7.134 if( have_shaders )
8.1 --- a/src/pvr2/glutil.c Fri Feb 24 21:11:58 2012 +1000
8.2 +++ b/src/pvr2/glutil.c Fri Feb 24 21:17:47 2012 +1000
8.3 @@ -125,6 +125,33 @@
8.4
8.5
8.6 /**
8.7 + * Define an orthographic projection matrix
8.8 + * Note: row-major order
8.9 + */
8.10 +void defineOrthoMatrix( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar )
8.11 +{
8.12 + matrix[0] = 2/width;
8.13 + matrix[1] = 0;
8.14 + matrix[2] = 0;
8.15 + matrix[3] = 0;
8.16 +
8.17 + matrix[4] = 0;
8.18 + matrix[5] = -2/height;
8.19 + matrix[6] = 0;
8.20 + matrix[7] = 0;
8.21 +
8.22 + matrix[8] = 0;
8.23 + matrix[9] = 0;
8.24 + matrix[10]= -2/(zfar-znear);
8.25 + matrix[11]= 0;
8.26 +
8.27 + matrix[12]= -1;
8.28 + matrix[13]= 1;
8.29 + matrix[14]= -(zfar+znear)/(zfar-znear);
8.30 + matrix[15]= 1;
8.31 +}
8.32 +
8.33 +/**
8.34 * Format a GL extension list (or other space-separated string) nicely, and
8.35 * print to the given output stream.
8.36 */
9.1 --- a/src/pvr2/glutil.h Fri Feb 24 21:11:58 2012 +1000
9.2 +++ b/src/pvr2/glutil.h Fri Feb 24 21:17:47 2012 +1000
9.3 @@ -128,6 +128,9 @@
9.4 void glsl_unload_shaders(void);
9.5 void glsl_clear_shader();
9.6
9.7 +/* Define an orthographic transform matrix, given the bounding box (assuming origin at 0) */
9.8 +void defineOrthoMatrix( GLfloat *matrix, GLfloat width, GLfloat height, GLfloat znear, GLfloat zfar );
9.9 +
9.10 /* Convenience formatting function for driver use */
9.11 void fprint_extensions( FILE *out, const char *extensions );
9.12
10.1 --- a/src/pvr2/texcache.c Fri Feb 24 21:11:58 2012 +1000
10.2 +++ b/src/pvr2/texcache.c Fri Feb 24 21:17:47 2012 +1000
10.3 @@ -499,8 +499,6 @@
10.4 GLint max_filter = GL_LINEAR;
10.5 GLint mipmapfilter = GL_LINEAR_MIPMAP_LINEAR;
10.6
10.7 - glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
10.8 -
10.9 /* Decode the format parameters */
10.10 switch( tex_format ) {
10.11 case PVR2_TEX_FORMAT_IDX4:
.