Commit 176b165c authored by schultz's avatar schultz

use textureCoordination shader implementation in CoreProfiles

parent fee8d29a
......@@ -125,22 +125,19 @@ void RenderObject::initFromState( GLState* _glState )
pointSize = _glState->point_size();
}
if(_glState->compatibilityProfile())
{
// get texcoord generation params
if (glIsEnabled(GL_TEXTURE_GEN_Q))
if (_glState->isStateEnabled(GL_TEXTURE_GEN_Q))
shaderDesc.texGenDim = 4;
else if (glIsEnabled(GL_TEXTURE_GEN_R))
else if (_glState->isStateEnabled(GL_TEXTURE_GEN_R))
shaderDesc.texGenDim = 3;
else if (glIsEnabled(GL_TEXTURE_GEN_T))
else if (_glState->isStateEnabled(GL_TEXTURE_GEN_T))
shaderDesc.texGenDim = 2;
else if (glIsEnabled(GL_TEXTURE_GEN_S))
else if (_glState->isStateEnabled(GL_TEXTURE_GEN_S))
shaderDesc.texGenDim = 1;
}
if (shaderDesc.texGenDim)
{
GLint genMode = 0;
glGetTexGeniv(GL_S, GL_TEXTURE_GEN_MODE, &genMode);
GLint genMode;
_glState->getTexGenMode(GL_S, GL_TEXTURE_GEN_MODE, &genMode);
shaderDesc.texGenMode = genMode;
}
}
......
......@@ -98,14 +98,13 @@ void EnvMapNode::enter(GLState& _state, const DrawModes::DrawMode& _drawmode)
if (_drawmode==DrawModes::SOLID_ENV_MAPPED)
{
TextureNode::enter(_state, _drawmode);
if(_state.compatibilityProfile())
{
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
ACG::GLState::enable(GL_TEXTURE_GEN_S);
ACG::GLState::enable(GL_TEXTURE_GEN_T);
ACG::GLState::enable(GL_TEXTURE_2D);
}
ACG::GLState::setTexGenMode(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
ACG::GLState::setTexGenMode(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
ACG::GLState::enable(GL_TEXTURE_GEN_S, false);
ACG::GLState::enable(GL_TEXTURE_GEN_T, false);
if (_state.compatibilityProfile())
ACG::GLState::enable(GL_TEXTURE_2D);
} else
TextureNode::enter( _state, _drawmode);
}
......@@ -119,12 +118,10 @@ void EnvMapNode::leave(GLState& _state, const DrawModes::DrawMode& _drawmode)
if (_drawmode==DrawModes::SOLID_ENV_MAPPED)
{
TextureNode::leave(_state, _drawmode);
ACG::GLState::disable(GL_TEXTURE_GEN_S, false);
ACG::GLState::disable(GL_TEXTURE_GEN_T, false);
if(_state.compatibilityProfile())
{
ACG::GLState::disable(GL_TEXTURE_GEN_S);
ACG::GLState::disable(GL_TEXTURE_GEN_T);
ACG::GLState::disable(GL_TEXTURE_2D);
}
ACG::GLState::disable(GL_TEXTURE_2D);
} else
TextureNode::leave( _state, _drawmode);
}
......
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