PDA

View Full Version : opengl resize format



overseb
10-04-2004, 10:35 PM
Hi
I saw that in every ogl app, when I resize the ogl window on the Y axis, the objects are scaling to fit in the viewport and not to be deformed.
It acts like a camera back zoom or like an increase of the fov (wich is the Y angle of the field of view)
But on the X axis, there are not any deformation on the objects, they keep the same size on the viewport.

Do you have any solution to modify these settings ? For exemple, I would like my object to act the same way on X and Y axis. I don't want any zoom, if I resize my window on Y axis. Is it possible ?

thx

ZbuffeR
10-05-2004, 01:10 AM
Everything is possible.
The behaviour you described is defined in the program source. If you can have a look at it, you may understand a lot.

Search for glViewport, glFrustum, and other camera related calls.

Have a look at the doc :
http://pyopengl.sourceforge.net/documentation/manual/glFrustum.3G.html

And this sample :
http://cvs.sourceforge.net/viewcvs.py/py....viewcvs-markup (http://cvs.sourceforge.net/viewcvs.py/pyopengl/PyOpenGL2/OpenGL/Demo/redbook/cube.py?rev=HEAD&content-type=text/vnd.viewcvs-markup)
When resizing the window on this sample, the cube is distorted, but exactly the same world space is visible.
With glFrustum following the rescale in both X an Y, you will get the behaviour you want.

overseb
10-05-2004, 02:54 AM
ok thx a lot