From: Hector Martin Date: Sat, 18 Dec 2010 19:57:21 +0000 (+0100) Subject: Fix broken perspective transform matrix X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=88424dd739b92608cdc754b884526d7ee649656a;p=openlase-old.git Fix broken perspective transform matrix --- diff --git a/examples/simple.c b/examples/simple.c index 3cc7f3a..5776a14 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -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); diff --git a/libol/libol.c b/libol/libol.c index 1eb389b..7144f91 100644 --- a/libol/libol.c +++ b/libol/libol.c @@ -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);