]> Some of my projects - openlase-old.git/commitdiff
Fix broken perspective transform matrix
authorHector Martin <hector@marcansoft.com>
Sat, 18 Dec 2010 19:57:21 +0000 (20:57 +0100)
committerHector Martin <hector@marcansoft.com>
Sat, 18 Dec 2010 19:57:21 +0000 (20:57 +0100)
examples/simple.c
libol/libol.c

index 3cc7f3ac396f0d3bffd76d55c36977d69407e5e6..5776a14dd659eb549482c32c37679e7075fe79a1 100644 (file)
@@ -63,8 +63,8 @@ int main (int argc, char *argv[])
        while(1) {
                olLoadIdentity3();
                olLoadIdentity();
-               olPerspective(24, 1, 1, 100);
-               olTranslate3(0, 0, 4);
+               olPerspective(60, 1, 1, 100);
+               olTranslate3(0, 0, -3);
 
                for(i=0; i<2; i++) {
                        olScale3(0.6, 0.6, 0.6);
index 1eb389b7f25c90ac5c1b50069809562b0a94db57..7144f91df61297e6a411dbb346b63df10aade746 100644 (file)
@@ -1118,10 +1118,10 @@ void olSetAudioCallback(AudioCallbackFunc f)
 void olFrustum (float l, float r, float b, float t, float n, float f)
 {
        float m[16] = {
-               (2*n)/(r-l),  0,            (r+l)/(r-l),     0,
-               0,            (2*n)/(t-b),  (t+b)/(t-b),     0,
-               0,            0,            -(f+n)/(f-n),    (-2*f*n)/(f-n),
-               0,            0,            -1,              0,
+               (2*n)/(r-l),  0,            0,               0,
+               0,            (2*n)/(t-b),  0,               0,
+               (r+l)/(r-l),  (t+b)/(t-b),  -(f+n)/(f-n),   -1,
+               0,            0,            (-2*f*n)/(f-n),  0,
        };
 
        olMultMatrix3(m);