fdsgds<gv<df

This commit is contained in:
Anakin 2016-11-07 12:16:39 +01:00
parent ed66d77b69
commit 04d8c453f3
1 changed files with 10 additions and 3 deletions

View File

@ -277,9 +277,6 @@ void OpenGLController::updateScene()
for (unsigned int modelIndex = 0; modelIndex < vModels.size(); modelIndex++) for (unsigned int modelIndex = 0; modelIndex < vModels.size(); modelIndex++)
{ {
// give the MVPs to the shader // give the MVPs to the shader
glBindBuffer(GL_UNIFORM_BUFFER, gluiInstanceBufferID);
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), NULL, &getMVPMatrix(0));
glBindBuffer(GL_UNIFORM_BUFFER, 0);
//glUniformMatrix4fv(gluiMatrixID, 1, GL_FALSE, &getMVPMatrix(modelIndex)[0][0]); //glUniformMatrix4fv(gluiMatrixID, 1, GL_FALSE, &getMVPMatrix(modelIndex)[0][0]);
@ -385,4 +382,14 @@ void OpenGLController::loadMsh(const char * path)
tempBufferData.data(), tempBufferData.data(),
GL_STATIC_DRAW GL_STATIC_DRAW
); );
//TODO: limit to max model count
std::vector<glm::mat4> tempMVPs;
for (int i = 0; i < vModels.size(); i++)
tempMVPs.push_back(getMVPMatrix(i));
glBindBuffer(GL_UNIFORM_BUFFER, gluiInstanceBufferID);
glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4) * vModels.size(), NULL, tempMVPs.data());
glBindBuffer(GL_UNIFORM_BUFFER, 0);
} }