dodgyposse

11-17-2000, 12:34 AM

I am using a perspective transformation

as follows:

glViewport(0,0,640,480);

gluPerspective(45.0f,

(GLfloat)640.0/(GLfloat)480.0,0.1f,100.0f);

Under this scheme, I understand the plane of my screen is at z=0.1 and he origin lies at the centre of the screen....correct?

What I would like to do, is convert my game coordinates into screen pixels and vice versa.

does anyone have a formula for this?....

I currently have loads of bits of paper, littered with pytharous' theorum and

basic trig equations, but nothing which

clearly does what I want...

Basically, what I want, is a formula

which say that A pixels across the screen

represents Y world units, and

B pixels down the screen represents Z world units.

I need this for a utility class, which will

overlay 2d bitmaps onto my 3d stuff, drawing

them as 3d textured mapped quads in the plane z=0.0;

dd

as follows:

glViewport(0,0,640,480);

gluPerspective(45.0f,

(GLfloat)640.0/(GLfloat)480.0,0.1f,100.0f);

Under this scheme, I understand the plane of my screen is at z=0.1 and he origin lies at the centre of the screen....correct?

What I would like to do, is convert my game coordinates into screen pixels and vice versa.

does anyone have a formula for this?....

I currently have loads of bits of paper, littered with pytharous' theorum and

basic trig equations, but nothing which

clearly does what I want...

Basically, what I want, is a formula

which say that A pixels across the screen

represents Y world units, and

B pixels down the screen represents Z world units.

I need this for a utility class, which will

overlay 2d bitmaps onto my 3d stuff, drawing

them as 3d textured mapped quads in the plane z=0.0;

dd