Sign in to follow this  
one mind

gluPespective troubles

Recommended Posts

Hi, I have setup a window that is split into 4 viewports. 3 of the views are ortho and work nicely no matter what size my window is. The perspective view is killing me. It works fine when the window is perfectly square. If the window is resized horizontaly the polyon square i am rendering is stretched into a rectangle. If the width becomes less than the height the polygon dissapears. Here is how the perspective view is setup gluPerspective(45.0f, width/height ,0, 100); If i use 1 for the aspect ratio, the same streching problem exists but it doesn't disappear when the windows width is less than height. What i want to happen is that the square should remain a square no matter what size the window is. I acheived this with ortho views with this code if (half_width <= half_height) Gl.glOrtho (-nRange, nRange, -nRange*half_height/half_width, nRange*half_height/half_width,-nRange,nRange); else Gl.glOrtho (-nRange*half_width/half_height, nRange*half_width/half_height, -nRange, nRange,-nRange,nRange); *********************************************************** with half_width and half_height being the windows dimensions halved because the are rendered in only 1/4 of the overall window and nRange being 100.0f So basicaly, i just have to find a way to turn my ortho code into perspective code. Has anyone solved this problem? Any help would be greatly appreciated :) Thanks

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this