aspect ratio inaccurate when setting up perspective

Started by bobjob, September 30, 2007, 14:42:31

Previous topic - Next topic

bobjob

when i setup the perspective, it all looks fine.
GLU.gluPerspective(fov, aspectRatio, nearDisdance, farDistance);

but if the aspectRatio is 2. i assume that means 2*fov (along the width of the screen).
Am i correct?
because when i rotate and object (from the view point) in 1 aspect ratio by fov (or half of fov as it starts in the center of the screen). it will be centered on the edge of the screen,
but if i rotate when the aspect ratio is 2. it will not be were I expected it to be.
currently im forced to setup a specific aspect ratio to handle what i am doing, but i would like to be able to calculate interaction relative to the aspect ratio.

can someone please tell me the correct equation if i am wrong.

elias4444

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

bobjob

yeah, i get that, it makes for a good aspect ratio. width/height
but you can also force your own aspect ratio.
What i wanted to know is after you have the aspect ratio how do you work out the min and max rotation of the frustrum along the width of the screen. im sure that an aspectratio of 2 should be twice the fov, but it doesnt work that way. am i wrong in saying thats how the relationship of the aspectratio is to the fov?

elias4444

oh great... now you have me experimenting.  :P

I'm fiddling around with the aspectratio and fovy to see if I can remake what you're talking about. As I understand it though, if you rotate around the center viewpoint, it shouldn't matter what either of them are set to... of course though, that entirely depends on what kind of rotation you're talking about and where your camera is set.  :-\
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

bobjob

if you have and object placed away from the camera so you can see it in the center, eg. z value of -100
thats when the camera is set to, 0, 0, 0, and no rotation.

if the fov is = 45, and aspect ratio = 1.
then if you rotate the camera 22.5 degrees (becuse it is half of 45) on the x or y axis, the object will be placed on the border of the screen, or view point.

but yeah if you change the aspect ratio to anything other than 1 it doesnt seem to be accurate when rotating, still havnt worked it out.

i think im going to make my application handle just the basic aspect ratio's like 4:3, 16:9 and 16:10 instead of making it auto manage it. in order to get around the problem im having

bobjob

hmmm, problem solved, sorta.
got around it buy not using GLU

bobjob

Ok ALLLLLL good, i downloaded the lwjgl source and looked up the GLU source, all makes sense now.

yeah i was wrong about the relationship, its based on a cotangent.

anyways wow what a load off. :D