Commit 09934f6f authored by Andreas Neu's avatar Andreas Neu
Browse files

-RenderObject now checks if a mapped attribute location is != -1 before it...

-RenderObject now checks if a mapped attribute location is != -1 before it sets the pointer and enables the location.
parent e8a878d5
......@@ -73,14 +73,17 @@ void RenderObject::enableVertexBufferObject (void) const
for(AttributeMappingVec::size_type i = 0; i < mAttributeMappings.size(); i++)
{
if(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID != currentArrayBufferID)
if(mAttributeMappings[i].attributeLocation != -1)
{
mpVertexBufferObject->getArrayBuffers()[mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID]->bind();
currentArrayBufferID = mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID;
if(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID != currentArrayBufferID)
{
mpVertexBufferObject->getArrayBuffers()[mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID]->bind();
currentArrayBufferID = mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID;
}
mpVertexBufferObject->setAttributePointer(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].attributeID, mAttributeMappings[i].attributeLocation);
glEnableVertexAttribArray(mAttributeMappings[i].attributeLocation);
openGLRareError();
}
mpVertexBufferObject->setAttributePointer(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].attributeID, mAttributeMappings[i].attributeLocation);
glEnableVertexAttribArray(mAttributeMappings[i].attributeLocation);
openGLRareError();
}
}
......@@ -89,13 +92,16 @@ void RenderObject::disableVertexBufferObject (void) const
int currentArrayBufferID = -1;
for(AttributeMappingVec::size_type i = 0; i < mAttributeMappings.size(); i++)
{
if(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID != currentArrayBufferID)
if(mAttributeMappings[i].attributeLocation != -1)
{
mpVertexBufferObject->getArrayBuffers()[mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID]->bind();
currentArrayBufferID = mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID;
if(mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID != currentArrayBufferID)
{
mpVertexBufferObject->getArrayBuffers()[mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID]->bind();
currentArrayBufferID = mpVertexBufferObject->getAttributes()[mAttributeMappings[i].attributeID].bufferID;
}
glDisableVertexAttribArray(mAttributeMappings[i].attributeLocation);
openGLRareError();
}
glDisableVertexAttribArray(mAttributeMappings[i].attributeLocation);
openGLRareError();
}
}
......
Supports Markdown
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