WhatEver

01-24-2003, 06:56 PM

I've been researching this for a while now, and I'm not really getting anywhere.

Remember the old formula for perspective?

x=x*(1000/z);

y=y*(1000/z);

I want the reverse effect like this formula:

x=x*(z/1000);

y=y*(z/1000);

I want to do that very same thing with the projection matrix. I want it to scale away from the center of the screen intead of toward.

A simple projection matrix looks like this:

m[0]=1.0f;

m[1]=0.0f;

m[2]=0.0f;

m[3]=0.0f;

m[4]=0.0f;

m[5]=1.0f;

m[6]=0.0f;

m[7]=0.0f;

m[8]=0.0f;

m[9]=0.0f;

m[10]=1.0f;

m[11]=0.0f;

m[12]=0.0f;

m[13]=0.0f;

m[14]=1000.0f;

m[15]=1.0f;

However, the projection matrix that OpenGL creates with glFrustum looks like this:

n=near clipping plane

f=far clipping plane

l=left clipping plane

r=right clipping plane

t=top clipping plane

b=bottom clipping plane

m[0]=2*n/(r-l);

m[1]=0.0f;

m[2]=0.0f;

m[3]=0.0f;

m[4]=0.0f;

m[5]=2*n/(t-b);

m[6]=0.0f;

m[7]=0.0f;

m[8]=(r+l)/(r-l);

m[9]=(t+b)/(t-b);

m[10]=-(f+n)/(f-n);

m[11]=-1.0f;

m[12]=0.0f;

m[13]=0.0f;

m[14]=-2*f*n/(f-n);

m[15]=0.0f;

I need to modify the above matrix so that it projects outward instead of inward...but how??? I've been playing with this thing for two days now. It's a simple as swapping 1000 with z in the old formula. It should be just as simple with the matrix but I can't seem to pull it off http://www.opengl.org/discussion_boards/ubb/frown.gif.

[This message has been edited by WhatEver (edited 01-24-2003).]

Remember the old formula for perspective?

x=x*(1000/z);

y=y*(1000/z);

I want the reverse effect like this formula:

x=x*(z/1000);

y=y*(z/1000);

I want to do that very same thing with the projection matrix. I want it to scale away from the center of the screen intead of toward.

A simple projection matrix looks like this:

m[0]=1.0f;

m[1]=0.0f;

m[2]=0.0f;

m[3]=0.0f;

m[4]=0.0f;

m[5]=1.0f;

m[6]=0.0f;

m[7]=0.0f;

m[8]=0.0f;

m[9]=0.0f;

m[10]=1.0f;

m[11]=0.0f;

m[12]=0.0f;

m[13]=0.0f;

m[14]=1000.0f;

m[15]=1.0f;

However, the projection matrix that OpenGL creates with glFrustum looks like this:

n=near clipping plane

f=far clipping plane

l=left clipping plane

r=right clipping plane

t=top clipping plane

b=bottom clipping plane

m[0]=2*n/(r-l);

m[1]=0.0f;

m[2]=0.0f;

m[3]=0.0f;

m[4]=0.0f;

m[5]=2*n/(t-b);

m[6]=0.0f;

m[7]=0.0f;

m[8]=(r+l)/(r-l);

m[9]=(t+b)/(t-b);

m[10]=-(f+n)/(f-n);

m[11]=-1.0f;

m[12]=0.0f;

m[13]=0.0f;

m[14]=-2*f*n/(f-n);

m[15]=0.0f;

I need to modify the above matrix so that it projects outward instead of inward...but how??? I've been playing with this thing for two days now. It's a simple as swapping 1000 with z in the old formula. It should be just as simple with the matrix but I can't seem to pull it off http://www.opengl.org/discussion_boards/ubb/frown.gif.

[This message has been edited by WhatEver (edited 01-24-2003).]