Commit 8656de8c authored by Martin Schultz's avatar Martin Schultz
Browse files

adopted QOpenGL branch acg material node

parent 5125cd2b
......@@ -242,28 +242,52 @@ void MaterialNode::enter(GLState& _state, const DrawModes::DrawMode& _drawmode
_state.set_line_width(material_.lineWidth_);
}
if (applyProperties_ & RoundPoints)
{
materialBackup_.roundPoints_ = glIsEnabled(GL_POINT_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if (_state.compatibilityProfile())
{
// deprecated opengl caps
if( material_.roundPoints_ ) {
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
ACG::GLState::enable(GL_POINT_SMOOTH);
} else
ACG::GLState::disable(GL_POINT_SMOOTH);
}
if (applyProperties_ & RoundPoints)
{
materialBackup_.roundPoints_ = glIsEnabled(GL_POINT_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if (applyProperties_ & LineSmooth)
{
materialBackup_.linesSmooth_ = glIsEnabled(GL_LINE_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if (material_.roundPoints_) {
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
ACG::GLState::enable(GL_POINT_SMOOTH);
}
else
ACG::GLState::disable(GL_POINT_SMOOTH);
}
if (applyProperties_ & LineSmooth)
{
materialBackup_.linesSmooth_ = glIsEnabled(GL_LINE_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if (material_.linesSmooth_) {
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
ACG::GLState::enable(GL_LINE_SMOOTH);
}
else
ACG::GLState::disable(GL_LINE_SMOOTH);
}
if (applyProperties_ & AlphaTest)
{
materialBackup_.alphaTest_ = glIsEnabled(GL_ALPHA_TEST);
glGetFloatv(GL_ALPHA_TEST_REF, &materialBackup_.alphaClip_);
if (material_.alphaTest_)
{
ACG::GLState::alphaFunc(GL_GREATER, material_.alphaClip_);
ACG::GLState::enable(GL_ALPHA_TEST);
}
else
{
ACG::GLState::disable(GL_ALPHA_TEST);
}
}
if( material_.linesSmooth_ ) {
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
ACG::GLState::enable(GL_LINE_SMOOTH);
} else
ACG::GLState::disable(GL_LINE_SMOOTH);
}
if (applyProperties_ & MultiSampling)
......@@ -272,22 +296,6 @@ void MaterialNode::enter(GLState& _state, const DrawModes::DrawMode& _drawmode
_state.set_multisampling( material_.multiSampling_ );
}
if (applyProperties_ & AlphaTest)
{
materialBackup_.alphaTest_ = glIsEnabled(GL_ALPHA_TEST);
glGetFloatv(GL_ALPHA_TEST_REF, &materialBackup_.alphaClip_);
if(material_.alphaTest_)
{
ACG::GLState::alphaFunc(GL_GREATER, material_.alphaClip_ );
ACG::GLState::enable(GL_ALPHA_TEST);
}
else
{
ACG::GLState::disable(GL_ALPHA_TEST);
}
}
if (applyProperties_ & Blending)
{
......@@ -401,7 +409,7 @@ void MaterialNode::leave(GLState& _state, const DrawModes::DrawMode& _drawmode )
}
if (applyProperties_ & RoundPoints)
if ((applyProperties_ & RoundPoints) && _state.compatibilityProfile())
{
if( materialBackup_.roundPoints_)
ACG::GLState::enable(GL_POINT_SMOOTH);
......@@ -409,7 +417,7 @@ void MaterialNode::leave(GLState& _state, const DrawModes::DrawMode& _drawmode )
ACG::GLState::disable(GL_POINT_SMOOTH);
}
if (applyProperties_ & LineSmooth)
if ((applyProperties_ & LineSmooth) && _state.compatibilityProfile())
{
if( materialBackup_.linesSmooth_)
ACG::GLState::enable(GL_LINE_SMOOTH);
......@@ -420,7 +428,7 @@ void MaterialNode::leave(GLState& _state, const DrawModes::DrawMode& _drawmode )
if (applyProperties_ & MultiSampling)
_state.set_multisampling( materialBackup_.multiSampling_ );
if (applyProperties_ & AlphaTest)
if ((applyProperties_ & AlphaTest) && _state.compatibilityProfile())
{
if (materialBackup_.alphaTest_)
{
......
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