State::State():
Referenced(true)
{
#if !defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
_useModelViewAndProjectionUniforms = true;
_useVertexAttributeAliasing = true;
#else
_useModelViewAndProjectionUniforms = false;
_useVertexAttributeAliasing = false;
#endif
}
会对一些着色器变量做替换
osg/State.cpp
bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const
{
if (_useModelViewAndProjectionUniforms)
{
// replace ftransform as it only works with built-ins
State_Utils::replace(source, "ftransform()", "gl_ModelViewProjectionMatrix * gl_Vertex");
// replace built in uniform
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewMat