Commit b8593fa1 authored by Janis Born's avatar Janis Born
Browse files

controllers for VAO, ShaderProgram, FBO now apply external attribute settings...

controllers for VAO, ShaderProgram, FBO now apply external attribute settings before merging in their own
parent fb79eebb
......@@ -48,7 +48,7 @@ private:
// ===================================================================================================== \/
public:
virtual SharedVertexArrayObject create(void);
virtual bool update(SharedVertexArrayObject& vao);
virtual bool update(SharedVertexArrayObject& _vao);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
......
......@@ -81,8 +81,10 @@ SharedFrameBufferObject FrameBufferObjectControl::create(void)
// update the LocationMappings mapping, if present
if(mFragDataLocations)
{
fbo->setAttachmentLocations(mFragDataLocations);
SharedLocationMappings fboMappings = fbo->getAttachmentLocations();
mFragDataLocations->addLocations(fboMappings);
fbo->setAttachmentLocations(mFragDataLocations);
}
return fbo;
......
......@@ -130,6 +130,7 @@ void ShaderProgramControlFiles::setBindings(SharedShaderProgram &_shaderProgram)
_shaderProgram->setFragmentDataLocations( mFragmentDataLocations ); // will relink on it's own
openGLRareErrorOccured();
_shaderProgram->setAttributeLocations( mAttributeLocations );
SharedLocationMappings oldAttributeMap = _shaderProgram->getAttributeLocations();
mAttributeLocations->addLocations( oldAttributeMap ); // add as many old locations as possible without destoying the location map
_shaderProgram->setAttributeLocations( mAttributeLocations ); // will relink on it's own
......
......@@ -28,6 +28,7 @@ SharedVertexArrayObject VertexArrayObjectControl::create()
// merge the mappings of the new VAO into the linked LocationMappings object, if present
if(mAttributeLocations)
{
vao->setAttributeLocations(mAttributeLocations);
SharedLocationMappings vaoAttributeLocations = vao->getAttributeLocations();
mAttributeLocations->addLocations(vaoAttributeLocations);
vao->setAttributeLocations(mAttributeLocations);
......
......@@ -24,7 +24,7 @@ VertexArrayObjectControlFile::VertexArrayObjectControlFile(const char* _filename
ACGL::Utils::error() << "No valid VAO controller to load the geometry. Perhaps there is no loader for that file extension: " << _filename << std::endl;
}
bool VertexArrayObjectControlFile::load(SharedVertexArrayObject& vao)
bool VertexArrayObjectControlFile::load(SharedVertexArrayObject& _vao)
{
if(!mDataController)
return false;
......@@ -40,15 +40,16 @@ bool VertexArrayObjectControlFile::load(SharedVertexArrayObject& vao)
}
sab->setDataElements( tempData->getSize()/tempData->getStrideSize(), tempData->getData() );
vao->detachAllAttributes();
vao->attachAllAttributes(sab);
_vao->detachAllAttributes();
_vao->attachAllAttributes(sab);
// merge the mappings of the new VAO into the linked LocationMappings object, if present
if(mAttributeLocations)
{
SharedLocationMappings vaoAttributeLocations = vao->getAttributeLocations();
_vao->setAttributeLocations(mAttributeLocations);
SharedLocationMappings vaoAttributeLocations = _vao->getAttributeLocations();
mAttributeLocations->addLocations(vaoAttributeLocations);
vao->setAttributeLocations(mAttributeLocations);
_vao->setAttributeLocations(mAttributeLocations);
}
return true;
......
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