From Julien Valentin, "To sum up changes, I had:
-some extensions in GLExtensions - GL_TEXTURE_BUFFER as target in osg::StateSet - a VBO based transform feed back example " git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14651 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -137,7 +137,7 @@ void Program::ProgramBinary::assign(unsigned int size, const unsigned char* data
|
||||
Program::Program() :
|
||||
_geometryVerticesOut(1), _geometryInputType(GL_TRIANGLES),
|
||||
_geometryOutputType(GL_TRIANGLE_STRIP),
|
||||
_numGroupsX(0), _numGroupsY(0), _numGroupsZ(0)
|
||||
_numGroupsX(0), _numGroupsY(0), _numGroupsZ(0), _feedbackmode(GL_SEPARATE_ATTRIBS)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -180,6 +180,9 @@ Program::Program(const Program& rhs, const osg::CopyOp& copyop):
|
||||
_numGroupsX = rhs._numGroupsX;
|
||||
_numGroupsY = rhs._numGroupsY;
|
||||
_numGroupsZ = rhs._numGroupsZ;
|
||||
|
||||
_feedbackmode=rhs._feedbackmode;
|
||||
_feedbackout=rhs._feedbackout;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +226,9 @@ int Program::compare(const osg::StateAttribute& sa) const
|
||||
if( _numGroupsZ < rhs._numGroupsZ ) return -1;
|
||||
if( rhs._numGroupsZ < _numGroupsZ ) return 1;
|
||||
|
||||
if(_feedbackout<rhs._feedbackout) return -1;
|
||||
if(_feedbackmode<rhs._feedbackmode) return -1;
|
||||
|
||||
ShaderList::const_iterator litr=_shaderList.begin();
|
||||
ShaderList::const_iterator ritr=rhs._shaderList.begin();
|
||||
for(;
|
||||
@@ -248,6 +254,24 @@ void Program::compileGLObjects( osg::State& state ) const
|
||||
_shaderList[i]->compileShader( state );
|
||||
}
|
||||
|
||||
if(!_feedbackout.empty())
|
||||
{
|
||||
const PerContextProgram* pcp = getPCP(contextID);
|
||||
const GLExtensions* extensions = state.get<GLExtensions>();
|
||||
|
||||
unsigned int numfeedback = _feedbackout.size();
|
||||
const char**varyings = new const char*[numfeedback];
|
||||
const char **varyingsptr = varyings;
|
||||
for(std::vector<std::string>::const_iterator it=_feedbackout.begin();
|
||||
it!=_feedbackout.end();
|
||||
it++)
|
||||
{
|
||||
*varyingsptr++=(*it).c_str();
|
||||
}
|
||||
|
||||
extensions->glTransformFeedbackVaryings( pcp->getHandle(), numfeedback, varyings, _feedbackmode);
|
||||
delete [] varyings;
|
||||
}
|
||||
getPCP( contextID )->linkProgram(state);
|
||||
}
|
||||
|
||||
@@ -437,7 +461,7 @@ void Program::removeBindUniformBlock(const std::string& name)
|
||||
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
void Program::apply( osg::State& state ) const
|
||||
{
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
Reference in New Issue
Block a user