Commit c614cc17 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added correct fovy and aspect functions. Both values are now extracted from...

Added correct fovy and aspect functions. Both values are now extracted from the current projection matrix.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7207 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2078a0c2
......@@ -116,7 +116,7 @@ void GLState::initialize()
// thickness
set_point_size(1.0f);
set_line_width(1.0f);
// multisampling
set_multisampling(true);
......@@ -716,31 +716,48 @@ void GLState::set_twosided_lighting(bool _b)
void GLState::set_multisampling(bool _b)
{
multisampling_ = _b;
if (updateGL_)
{
makeCurrent();
if ( allow_multisampling_ ) {
if ( _b )
if ( _b )
glEnable( GL_MULTISAMPLE );
else
else
glDisable( GL_MULTISAMPLE );
} else {
multisampling_ = false;
if ( glIsEnabled( GL_MULTISAMPLE ) )
glDisable( GL_MULTISAMPLE );
}
}
}
//-----------------------------------------------------------------------------
double GLState::fovy() const
{
assert(projection_(0,0) != 0.0);
return atan(1.0/projection_(0,0))*2.0;
}
//-----------------------------------------------------------------------------
double GLState::aspect() const
{
assert(projection_(1,1) != 0.0);
return projection_(0,0) / projection_(1,1);
}
//-----------------------------------------------------------------------------
......
......@@ -265,10 +265,10 @@ public:
double far_plane() const { return far_plane_; }
/// get field of view in y direction
double fovy() const { return fovy_; }
double fovy() const;
/// get aspect ratio
double aspect() const { return aspect_; }
double aspect() const;
/// get eye point
Vec3d eye() const;
......@@ -379,18 +379,18 @@ public:
void set_twosided_lighting(bool _b);
/// get whether transparenet or solid objects should be drawn
bool twosided_lighting() { return twosided_lighting_; }
//--- Multi Sampling --------------------------------------------------------
/// Enable or disable multisampling
void set_multisampling( bool _b );
/// Get current multisampling state
bool multisampling(){ return multisampling_; };
/// Disable multisampling globally
void allow_multisampling( bool _b ) { allow_multisampling_ = _b; };
/// Check if Multisampling is globally disabled
bool multisampling_alloowed(){ return allow_multisampling_; };
......@@ -408,7 +408,7 @@ public:
void pick_init (bool _color);
/// sets the maximum used name index at current stack position (only used in color picking)
/// A restriction inside the color picking implementation forces to set the maximum used
/// A restriction inside the color picking implementation forces to set the maximum used
/// number for the following pick_set_name calls between the two pick_push_name/pick_pop_name calls.
bool pick_set_maximum (unsigned int _idx);
......
Supports Markdown
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