From Mike Weiblen, further work on GLSL support
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
/* file: src/osg/Program.cpp
|
||||
* author: Mike Weiblen 2005-04-29
|
||||
* author: Mike Weiblen 2005-05-05
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
@@ -2100,6 +2100,16 @@ bool Program::getGlProgramInfoLog(unsigned int contextID, std::string& log) cons
|
||||
return getPCP( contextID )->getInfoLog( log );
|
||||
}
|
||||
|
||||
const Program::NameInfoMap& Program::getActiveUniforms(unsigned int contextID) const
|
||||
{
|
||||
return getPCP( contextID )->getActiveUniforms();
|
||||
}
|
||||
|
||||
const Program::NameInfoMap& Program::getActiveAttribs(unsigned int contextID) const
|
||||
{
|
||||
return getPCP( contextID )->getActiveAttribs();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// osg::Program::PerContextProgram
|
||||
// PCP is an OSG abstraction of the per-context glProgram
|
||||
@@ -2138,8 +2148,8 @@ void Program::PerContextProgram::linkProgram()
|
||||
<< " id=" << _glProgramHandle
|
||||
<< std::endl;
|
||||
|
||||
_uniformLocationMap.clear();
|
||||
_attribLocationMap.clear();
|
||||
_uniformInfoMap.clear();
|
||||
_attribInfoMap.clear();
|
||||
|
||||
// set any explicit vertex attribute bindings
|
||||
const AttribBindingList& bindlist = _program->getAttribBindingList();
|
||||
@@ -2170,7 +2180,7 @@ void Program::PerContextProgram::linkProgram()
|
||||
// dont build maps if link failed
|
||||
if( ! _isLinked ) return;
|
||||
|
||||
// build _uniformLocationMap
|
||||
// build _uniformInfoMap
|
||||
GLint numUniforms = 0;
|
||||
GLsizei maxLen = 0;
|
||||
_extensions->glGetProgramiv( _glProgramHandle, GL_ACTIVE_UNIFORMS, &numUniforms );
|
||||
@@ -2190,7 +2200,7 @@ void Program::PerContextProgram::linkProgram()
|
||||
|
||||
if( loc != -1 )
|
||||
{
|
||||
_uniformLocationMap[name] = loc;
|
||||
_uniformInfoMap[name] = std::pair<GLint,GLenum>(loc,type);
|
||||
|
||||
osg::notify(osg::INFO)
|
||||
<< "\tUniform \"" << name << "\""
|
||||
@@ -2202,7 +2212,7 @@ void Program::PerContextProgram::linkProgram()
|
||||
delete [] name;
|
||||
}
|
||||
|
||||
// build _attribLocationMap
|
||||
// build _attribInfoMap
|
||||
GLint numAttrib = 0;
|
||||
_extensions->glGetProgramiv( _glProgramHandle, GL_ACTIVE_ATTRIBUTES, &numAttrib );
|
||||
_extensions->glGetProgramiv( _glProgramHandle, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLen );
|
||||
@@ -2221,7 +2231,7 @@ void Program::PerContextProgram::linkProgram()
|
||||
|
||||
if( loc != -1 )
|
||||
{
|
||||
_attribLocationMap[name] = loc;
|
||||
_attribInfoMap[name] = std::pair<GLint,GLenum>(loc,type);
|
||||
|
||||
osg::notify(osg::INFO)
|
||||
<< "\tAttrib \"" << name << "\""
|
||||
|
||||
@@ -120,7 +120,7 @@ void State::reset()
|
||||
apitr!=_appliedProgramObjectSet.end();
|
||||
++apitr)
|
||||
{
|
||||
(*apitr)->resetAppliedUnifroms();
|
||||
(*apitr)->resetAppliedUniforms();
|
||||
}
|
||||
|
||||
_appliedProgramObjectSet.clear();
|
||||
|
||||
@@ -935,7 +935,7 @@ Uniform* StateSet::getOrCreateUniform(const std::string& name, Uniform::Type typ
|
||||
|
||||
// no uniform found matching name so create it..
|
||||
|
||||
Uniform* uniform = new Uniform(name,type);
|
||||
Uniform* uniform = new Uniform(type,name);
|
||||
addUniform(uniform);
|
||||
|
||||
return uniform;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
/* file: src/osg/Uniform.cpp
|
||||
* author: Mike Weiblen 2005-04-21
|
||||
* author: Mike Weiblen 2005-05-05
|
||||
*/
|
||||
|
||||
#include <osg/Notify>
|
||||
@@ -34,8 +34,8 @@ Uniform::Uniform() :
|
||||
}
|
||||
|
||||
|
||||
Uniform::Uniform( const std::string& name, Type type ) :
|
||||
_name(name), _type(type),_modifiedCount(0)
|
||||
Uniform::Uniform( Type type, const std::string& name ) :
|
||||
_type(type), _name(name), _modifiedCount(0)
|
||||
{
|
||||
setDataVariance(STATIC);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user