Archived

This topic is now archived and is closed to further replies.

dnagcat

Where is the origin?

Recommended Posts

OK...Im using gluPerspective(90, 1, 1, 20) <--I think these are the values Im using, off the top of my head. What I want to know is where is the origin...(0,0,0)... The reason I ask is because I am pointing in space with my cursor and placing objects in this space...but then when I rotate them if they are not at the origin I get strange behavior... I am using glUnProject and glReadPixels to get 3d points from the 2d position on the screen so I need to place my object in the direct center somehow...the value glReadPixel gets is 20...But if I glTranlate say -10 in the z direction glReadPixels will be 10...so is this my origin now??? Dazed and confused... Check out: www.lanceusa.com Link

Share this post


Link to post
Share on other sites
actually, if you translate something -10 units on an axis with glTranslatef you always get the opposit (that is 10) result. this is because the vertice''s coordinates are divided by w, which is usualy negative.

the origin of your coordinate system is 1 unit behind you, if you used glPerspective(90, 1, 1, 20), since the third parameter to glPerspective represents the distance from the camera to the near-plane of the view-frustum.

if your transformations lead to a *strange* result, you should play a little around with the command order

ps: 90 degrees is a really bad view-angle. the image will only look realistic, if you have your eye directly on the screen-plane... i suggest setting the value to something less then 45 degrees, and translating the origin by a greater (smaller, if you see negative numbers as smaller then zero) z-value. at 45 degrees, you''ll have to translate the camera by -0.5*sqrt(2) (or sin(45)) for each 1 height or width unit your model is to be

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
90 fov isn''t a bad fov, wolfenstein uses it, for example, and it looks vey good (and when make a zoom 22.5 fov this increases the difference between the two fovs)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What is the distance between the camera and the near plane in Wolfenstein?

I am only asking because I tried 90fov with a near plane of 1 and it looked bad.

Share this post


Link to post
Share on other sites