View Full Version : glFrustum and textures
10-10-2001, 12:49 AM
This is really confusing me, can anyone help:
having changed from gluPerspective to glFrustum, to stop my image distorting, the very pretty texture i had as the sky has disappeared, and now i'm just left with the background colour, which pretty much ruins the image.
any ideas would be appreciated.
Did you convert the parameters from gluPErspective to glFrustum properly? How did you do, and what parameters are you passing to glFrustum?
If nothing more than the backround shows up, you have certainly passing some strange parameters.
By the way, what do you mean by distorted images? gluPerspective uses glFrustum to build the projection matrix, so there aren't any differences, apart form the arguments you pass.
10-10-2001, 01:58 AM
As far as i know the parameters are correct. Originally the image was square, but i wanted to make it rectangular (roughly monitor shaped). the problem was that when i made the viewport rectangular, the image just stretched sideways.
i tried altering the aspect, and the field of view to no avail, so when someone suggested glFrustum, i tried that.
i pass the left, right, top and bottom parameters to glFrustum, as well as the near and far limits. the image now looks correct, the object in the centre of the screen appears correctly, and the ground terrain (which is textured) also appears correct
When you changed the aspect ratio, did anything at all happened to your image, or did it remain unchanged?
Give some more detail on what you did, like code, formulas.
10-10-2001, 02:45 AM
Changing the aspect ratio made no difference to the image.
the code while using gluPerspective was (it's written in fortran90 btw):
aspect = real(632/450)
call gluPerspective(75.0_gldouble, aspect, 0.1_gldouble, 100000.0_gldouble)
the image was 632 pixels wide by 450 high.
the glFrustum code is:
call glFrustum(0.14_gldouble, -0.14_gldouble, -0.1_gldouble, 0.1_gldouble, 0.2_gldouble, 100000.0_gldouble)
To me, it seems like the aspect ratio is constant, not depending on any variable holding the size of the viewport.
And I strogly suggest you lower the near to far ratio a bit. The bigger the ratio far/near, the less percise is the depthbuffer. If you need your far plane at 100000, I suggest you move the near plane up to about 10, if not even 100.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.