Commit 2e624097 authored by Jan Möbius's avatar Jan Möbius

Fixed wrong colors in picking, fixed wrong colors in translation manipulator node

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15749 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 35e9ca25
......@@ -689,6 +689,21 @@ void GLState::set_base_color(const Vec4f& _col)
}
}
//-----------------------------------------------------------------------------
void GLState::set_color(const Vec4f& _col)
{
color_ = _col;
if (updateGL_)
{
makeCurrent();
glColor(color_);
}
}
//-----------------------------------------------------------------------------
......
......@@ -824,6 +824,12 @@ public:
static const float default_shininess;
/// set color
void set_color(const Vec4f& _col);
/// set color
const Vec4f& color(const Vec4f& _col) { return color_; };
/// set background color
void set_clear_color(const Vec4f& _col);
/// get background color
......@@ -1071,6 +1077,7 @@ private: //--------------------------------------------------------------------
// colors & materials
Vec4f clear_color_,
color_,
base_color_,
ambient_color_,
diffuse_color_,
......
......@@ -227,6 +227,8 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
if ( (_drawMode & DrawModes::POINTS) || (_drawMode & DrawModes::POINTS_COLORED) || (_drawMode & DrawModes::POINTS_SHADED ) ) {
_state.set_color( _state.specular_color() );
ACG::GLState::shadeModel(GL_FLAT);
if ( _drawMode & DrawModes::POINTS_SHADED ) {
......@@ -260,7 +262,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
if (_drawMode & DrawModes::WIREFRAME)
{
// enable_arrays( VERTEX_ARRAY | LINE_INDEX_ARRAY );
glColor( _state.specular_color() );
_state.set_color( _state.specular_color() );
ACG::GLState::disable(GL_LIGHTING);
ACG::GLState::shadeModel(GL_FLAT);
......@@ -285,7 +287,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
Vec4f clear_color = _state.clear_color();
clear_color[3] = 1.0;
glColor( clear_color );
_state.set_color( clear_color );
ACG::GLState::depthRange(0.01, 1.0);
draw_faces();
......@@ -296,7 +298,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
// enable_arrays(VERTEX_ARRAY|LINE_INDEX_ARRAY);
ACG::GLState::depthFunc(GL_LEQUAL);
glColor( _state.specular_color() );
_state.set_color( _state.specular_color() );
draw_lines();
......@@ -316,7 +318,7 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
if (_drawMode & DrawModes::HALFEDGES)
{
glColor( _state.specular_color() );
_state.set_color( _state.specular_color() );
enable_arrays( PER_HALFEDGE_VERTEX_ARRAY);
ACG::GLState::disable(GL_LIGHTING);
......@@ -1006,7 +1008,7 @@ pick_vertices(GLState& _state, bool _front)
clear_color[3] = 1.0;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_state.set_base_color(clear_color);
glColor(clear_color);
ACG::GLState::depthRange(0.01, 1.0);
draw_faces();
......@@ -1014,7 +1016,7 @@ pick_vertices(GLState& _state, bool _front)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
ACG::GLState::depthFunc(GL_LEQUAL);
_state.set_base_color(base_color);
glColor(base_color);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
......@@ -1083,7 +1085,7 @@ pick_edges(GLState& _state, bool _front)
clear_color[3] = 1.0;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_state.set_base_color(clear_color);
glColor(clear_color);
ACG::GLState::depthRange(0.01, 1.0);
draw_faces();
......@@ -1091,7 +1093,7 @@ pick_edges(GLState& _state, bool _front)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
ACG::GLState::depthFunc(GL_LEQUAL);
_state.set_base_color(base_color);
glColor(base_color);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
......
......@@ -629,12 +629,12 @@ void TranslationManipulatorNode::drawManipulator (GLState& _state, bool _active)
{
_state.set_diffuse_color(element_[XRing].active_current_color_);
_state.set_ambient_color(element_[XRing].active_current_color_);
_state.set_base_color(element_[XRing].active_current_color_);
_state.set_color(element_[XRing].active_current_color_);
} else {
_state.set_diffuse_color(element_[XRing].inactive_current_color_);
_state.set_ambient_color(element_[XRing].inactive_current_color_);
_state.set_base_color(element_[XRing].inactive_current_color_);
_state.set_color(element_[XRing].inactive_current_color_);
}
......@@ -648,12 +648,12 @@ void TranslationManipulatorNode::drawManipulator (GLState& _state, bool _active)
{
_state.set_diffuse_color(element_[YRing].active_current_color_);
_state.set_ambient_color(element_[YRing].active_current_color_);
_state.set_base_color(element_[YRing].active_current_color_);
_state.set_color(element_[YRing].active_current_color_);
} else {
_state.set_diffuse_color(element_[YRing].inactive_current_color_);
_state.set_ambient_color(element_[YRing].inactive_current_color_);
_state.set_base_color(element_[YRing].inactive_current_color_);
_state.set_color(element_[YRing].inactive_current_color_);
}
......@@ -666,12 +666,12 @@ void TranslationManipulatorNode::drawManipulator (GLState& _state, bool _active)
{
_state.set_diffuse_color(element_[ZRing].active_current_color_);
_state.set_ambient_color(element_[ZRing].active_current_color_);
_state.set_base_color(element_[ZRing].active_current_color_);
_state.set_color(element_[ZRing].active_current_color_);
} else {
_state.set_diffuse_color(element_[ZRing].inactive_current_color_);
_state.set_ambient_color(element_[ZRing].inactive_current_color_);
_state.set_base_color(element_[ZRing].inactive_current_color_);
_state.set_color(element_[ZRing].inactive_current_color_);
}
......
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