TamusRoyce

08-07-2003, 10:22 PM

I've tired many ways of getting matrix math to do what I need it to do, and all ways have failed. I have posted a previous message because of this problem (I just though it was another problem). I can't get OpenGL's Projection Matrix to function like I need it under C++...

What I want is a matrix set up as so:

{2.0f/ScreenWidth, 0.0f, 0.0f, 0.0f,

0.0f, 2.0f/ScreenHeight, 0.0f, 0.0f,

0.0f, 0.0f, 0.0f, 1/Depth,

-1.0f, -1.0f, -1.0f, 0.0f};

but 1/Depth changes to z/depth, and then is multiplied through with depth/z. I want z/depth to multiply though. Is this a bug in which OpenGL was built upon?

Thus,

NewX = ((2.0f / ScreenWidth - 1.0f) * x) *

(Depth / z);

NewY = ((2.0f / ScreenHeight - 1.0f) * y) *

(Depth / z);

Instead of what I want, which is:

NewX = ((2.0f / ScreenWidth - 1.0f) * x) *

(z / Depth);

NewY = ((2.0f / ScreenWidth - 1.0f) * y) *

(z / Depth);

percent = z / depth;

garbage = depth / z;

Any help in flipping z with Depth in this equation would be most helpful. I can't do anything with OpenGL unless I can set it up in a way that I can use, and with this equation I want, I am able to convert 3D points on the screen into there 2D points and 2D /w z value into 3D points. Cad like calculations (and like actually getting info from OpenGL w/out using OpenGL functions).

This is my most desprate question I have ever had with programming. This stupid equation has almost made me give up programming all together... Hobbies should be fun, not frustrating. Thanks for reading my problem.

What I want is a matrix set up as so:

{2.0f/ScreenWidth, 0.0f, 0.0f, 0.0f,

0.0f, 2.0f/ScreenHeight, 0.0f, 0.0f,

0.0f, 0.0f, 0.0f, 1/Depth,

-1.0f, -1.0f, -1.0f, 0.0f};

but 1/Depth changes to z/depth, and then is multiplied through with depth/z. I want z/depth to multiply though. Is this a bug in which OpenGL was built upon?

Thus,

NewX = ((2.0f / ScreenWidth - 1.0f) * x) *

(Depth / z);

NewY = ((2.0f / ScreenHeight - 1.0f) * y) *

(Depth / z);

Instead of what I want, which is:

NewX = ((2.0f / ScreenWidth - 1.0f) * x) *

(z / Depth);

NewY = ((2.0f / ScreenWidth - 1.0f) * y) *

(z / Depth);

percent = z / depth;

garbage = depth / z;

Any help in flipping z with Depth in this equation would be most helpful. I can't do anything with OpenGL unless I can set it up in a way that I can use, and with this equation I want, I am able to convert 3D points on the screen into there 2D points and 2D /w z value into 3D points. Cad like calculations (and like actually getting info from OpenGL w/out using OpenGL functions).

This is my most desprate question I have ever had with programming. This stupid equation has almost made me give up programming all together... Hobbies should be fun, not frustrating. Thanks for reading my problem.