Commit 479f6e0e authored by Jan Möbius's avatar Jan Möbius

Dennis: Calculate aspect ratio from viewport.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6973 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4429cb9f
......@@ -230,12 +230,17 @@ draw(GLState& _state , unsigned int /*_drawMode*/)
if ( mode_ == SCREENPOS ) {
int left, bottom, width, height;
double aspect = 1.0;
_state.get_viewport(left, bottom, width, height);
if (width && height)
aspect = width / height;
// Projection reset
_state.push_projection_matrix();
_state.reset_projection();
_state.perspective(45.0, _state.aspect(), 0.8, 20.0);
_state.perspective(45.0, aspect, 0.8, 20.0);
float posx = left + width - 30.0 ;
float posy = bottom + height - 30.0 ;
......@@ -376,12 +381,17 @@ CoordsysNode::pick(GLState& _state, PickTarget _target)
if ( mode_ == SCREENPOS ) {
int left, bottom, width, height;
double aspect = 1.0;
_state.get_viewport(left, bottom, width, height);
if (width && height)
aspect = width / height;
// Projection reset
_state.push_projection_matrix();
_state.reset_projection();
_state.perspective(45.0, _state.aspect(), 0.8, 20.0);
_state.perspective(45.0, aspect, 0.8, 20.0);
float posx = left + width - 30.0 ;
float posy = bottom + height - 30.0 ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment