how to make a perspective matrix work


i'm trying head around 3d graphics, ran trouble.

 

i have number of points make cube. simple.

 

i use orthographic projection matrix display it.

 

but when try apply perspective projection matrix looks cube. i've tried multiple ways work still doesn't.

 

you can download source code here: http://www.bastardindustries.com/temp/example.zip

 

it written in actionscript 3.0. code basic , straight forward don't think it's problem if not familiar actionscript.

 

by commenting uncommenting following lines (in 3dgraphics.as) can switch between orthographic projection , perspective projection matrix. can see when using orthographic projection matrix works fine. perspective doesn't.

 

// ortographic , perspective
// mp = mpers.multiplymatrix(morto);

 

// ortographic
mp = morto;

 

any on why perspective matrix isn't working appreciated.

 

the perspective matrix looks this. in column major order:

 

n near plane , f far plane.

 

ma[0] = n;
ma[5] = n;
ma[10] = n+f;
ma[11] = 1;
ma[14] = -(f*n);
ma[15] = 0;

 

thanks!

this thread writting in website since left unanswered

 

/ magnus



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???