diff libvo/matrixview.c @ 34337:f8c523d09e5e

Use glLoadMatrixf. This makes it easier to support OpenGL ES.
author reimar
date Sat, 10 Dec 2011 20:21:50 +0000
parents fab4513840cb
children f464ea910bd2
line wrap: on
line diff
--- a/libvo/matrixview.c	Sat Dec 10 14:31:28 2011 +0000
+++ b/libvo/matrixview.c	Sat Dec 10 20:21:50 2011 +0000
@@ -310,15 +310,23 @@
 
 void matrixview_reshape(int w, int h)
 {
+    double nearplane = -Z_Off - Z_Depth;
+    // perspective projection, also adjusting vertex position
+    // by Z_Off and with simplified Z equation since the absolute
+    // Z value does not matter, only relative to other pixels
+    float matrix[16] = {
+      nearplane / _text_x, 0, 0, 0,
+      0, nearplane / _text_y, 0, 0,
+      0, 0,  1, -1,
+      0, 0,  0, -Z_Off
+    };
     mpglViewport(0, 0, w, h);
 
     mpglMatrixMode(GL_PROJECTION);
-    mpglLoadIdentity();
-    mpglFrustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off);
+    mpglLoadMatrixf(matrix);
 
     mpglMatrixMode(GL_MODELVIEW);
     mpglLoadIdentity();
-    mpglTranslated(0.0f, 0.0f, Z_Off);
 }