OpenGL newbie question
Hi,
I am following NeHe''s tutorial, and just on lesson 2!!
Ok, I get the triangle and the square. When I resize the window (by mouse) vertically, the triangle and square get scaled. When I do the same horizontally, they get clipped.
Why is so? The code for "ReSizeGLScene" function seems symmetric wrt width and height!¨
Thanks a lot
Uday
This only occurs when you use gluPerspective, if you use an ortho projection the image is not clipped no matter how far you shrink the window horizontally.
Its probably something to do with the field of view variable, in order to prevent clipping this will need to be modified to adjust the program to the new window dimension.
Its probably something to do with the field of view variable, in order to prevent clipping this will need to be modified to adjust the program to the new window dimension.
Because of this line
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
witch changes the aspect ratio of the screen, replace it with this
gluPerspective(45.0f,1.33,0.1f,100.0f);
to have it scale both ways.
[edited by - lc_overlord on November 21, 2002 12:04:26 PM]
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
witch changes the aspect ratio of the screen, replace it with this
gluPerspective(45.0f,1.33,0.1f,100.0f);
to have it scale both ways.
[edited by - lc_overlord on November 21, 2002 12:04:26 PM]
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
Thanks for your replies.
But using a fixed value like 1.33 for gluPerspective causes the distortion in the triangle shape, which was not happening before. If I resized vertically, the triangle and square were getting scle proportionately without any distortion.
In case of orthographic projection, how do I set the left right top bottom parameters with respect to current viewport size?
Thanks again
But using a fixed value like 1.33 for gluPerspective causes the distortion in the triangle shape, which was not happening before. If I resized vertically, the triangle and square were getting scle proportionately without any distortion.
In case of orthographic projection, how do I set the left right top bottom parameters with respect to current viewport size?
Thanks again
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement