Commit 9113b214 authored by Martin Schultz's avatar Martin Schultz

moved further compatibility calls to ifs so they are not called, when core Profile is used

parent 03563fbf
......@@ -174,8 +174,11 @@ ManipulatorNode::draw(GLState& _state, const DrawModes::DrawMode& /* _drawMode *
{
if (draw_cylinder_)
{
ACG::GLState::enable(GL_LIGHTING);
ACG::GLState::shadeModel(GL_FLAT);
if(_state.compatibilityProfile())
{
ACG::GLState::enable(GL_LIGHTING);
ACG::GLState::shadeModel(GL_FLAT);
}
// backup colors
......@@ -209,7 +212,8 @@ ManipulatorNode::draw(GLState& _state, const DrawModes::DrawMode& /* _drawMode *
glLoadIdentity();
glRotatef(-90, 0.0, 1.0, 0.0);*/
ACG::GLState::shadeModel(GL_SMOOTH);
if(_state.compatibilityProfile())
ACG::GLState::shadeModel(GL_SMOOTH);
cylinder_->setBottomRadius(cylinder_radius_);
cylinder_->setTopRadius(cylinder_radius_);
cylinder_->draw(_state, cylinder_height_);
......@@ -222,8 +226,11 @@ ManipulatorNode::draw(GLState& _state, const DrawModes::DrawMode& /* _drawMode *
{
_state.set_diffuse_color(select_color * 0.6f);
_state.set_specular_color(select_color * 0.0f);
ACG::GLState::shadeModel(GL_SMOOTH);
glutWireSphere(cylinder_height_+4*cylinder_radius_, 20, 20);
if(_state.compatibilityProfile())
{
ACG::GLState::shadeModel(GL_SMOOTH);
glutWireSphere(cylinder_height_+4*cylinder_radius_, 20, 20);
}
}
_state.pop_modelview_matrix();
......@@ -247,8 +254,11 @@ ManipulatorNode::draw(GLState& _state, const DrawModes::DrawMode& /* _drawMode *
_state.set_specular_color(sphere_color * 0.8f);
}
ACG::GLState::shadeModel(GL_SMOOTH);
glutSolidSphere(2*cylinder_radius_, 20, 20);
if(_state.compatibilityProfile())
{
ACG::GLState::shadeModel(GL_SMOOTH);
glutSolidSphere(2*cylinder_radius_, 20, 20);
}
_state.pop_modelview_matrix();
......@@ -560,7 +570,8 @@ void ManipulatorNode::pick(GLState& _state, PickTarget _target) {
_state.push_modelview_matrix();
setup_sphere_system(_state);
_state.pick_set_name(1);
glutSolidSphere(2* cylinder_radius_ , 20, 20);
if(_state.compatibilityProfile())
glutSolidSphere(2* cylinder_radius_ , 20, 20);
_state.pop_modelview_matrix();
}
}
......
......@@ -61,6 +61,7 @@
#include <ACG/Geometry/GPUCacheOptimizer.hh>
#include <ACG/GL/DrawMesh.hh>
#include <ACG/GL/GLError.hh>
#include <ACG/GL/GLState.hh>
//== NAMESPACES ===============================================================
......@@ -1497,7 +1498,7 @@ pick_any(GLState& _state)
omerr() << "MeshNode::pick_any: color range too small, " << "picking failed\n";
return;
}
if (_state.color_picking() && drawMesh_) {
// picking implementations:
......@@ -1505,6 +1506,8 @@ pick_any(GLState& _state)
// 1 -> render mesh with picking shader (optimized, add. mem alloc: none [ shared memory with optimized vertex,edge,face picking ])
int pickImplementationMethod = 0;
if(!_state.compatibilityProfile())
pickImplementationMethod = 1;
// use optimized picking if supported
if (drawMesh_->supportsPickingAny_opt())
......@@ -1519,7 +1522,7 @@ pick_any(GLState& _state)
anyPickingBaseIndex_ = _state.pick_current_index ();
updateAnyPicking_ = false;
}
if (pickImplementationMethod == 0){
// For this version we load the colors directly, not from vbo
ACG::GLState::bindBuffer(GL_ARRAY_BUFFER_ARB, 0);
......
......@@ -238,7 +238,8 @@ void
TranslationManipulatorNode::update_rotation(GLState& _state){
// Get global transformation
glMatrixMode(GL_MODELVIEW);
if(_state.compatibilityProfile())
glMatrixMode(GL_MODELVIEW);
GLMatrixd model = _state.modelview();
// revert global transformation as we want to use our own
......@@ -2012,7 +2013,10 @@ pick(GLState& _state, PickTarget _target)
_state.pick_set_maximum(5);
// Enable depth test but store original status
glPushAttrib(GL_DEPTH_BUFFER_BIT);
if(_state.compatibilityProfile())
glPushAttrib(GL_DEPTH_BUFFER_BIT);
GLboolean depthTest;
glGetBooleanv(GL_DEPTH_TEST, &depthTest);
ACG::GLState::enable(GL_DEPTH_TEST);
ACG::GLState::depthFunc(GL_LEQUAL);
......@@ -2100,9 +2104,12 @@ pick(GLState& _state, PickTarget _target)
circle_->draw(_state);
// Restore old attributes and modelview
glPopAttrib();
if(_state.compatibilityProfile())
glPopAttrib();
_state.pop_modelview_matrix();
if(depthTest)
ACG::GLState::enable(GL_DEPTH_TEST);
//restore original depth comparison function
ACG::GLState::depthFunc(prev_depth);
}
......
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