Permalink
Browse files

Merge branch 'master' into shaders

  • Loading branch information...
2 parents 9fb4db7 + c7c110f commit 21bed7dd924e957a9929f9ef1181c10b9ecec97d @Xrew Xrew committed Dec 13, 2011
Showing with 8 additions and 6 deletions.
  1. +5 −5 Scene.cpp
  2. +3 −1 ShaderManager.cpp
View
@@ -251,14 +251,14 @@ void Scene::draw(bool drawAmbient, bool drawLighting, vector<bool> enabledLights
Mesh* mesh = (*it).mesh;
string meshMaterial = mesh->getMaterialName();
+ // za material se povazuje jen nazev pred podtrzitkem
+ string::size_type pos = meshMaterial.find("_");
+ if (pos != string::npos)
+ meshMaterial = meshMaterial.substr(0, pos);
+
// prepinat shadery jen pokud je treba
if (activeMaterial != meshMaterial)
{
- // za material se povazuje jen nazev pred podtrzitkem
- string::size_type pos = meshMaterial.find("_");
- if (pos != string::npos)
- meshMaterial = meshMaterial.substr(0, pos);
-
// prepnout na novy shader
activeMaterial = meshMaterial;
activeBinding = ShaderManager::useProgram(activeMaterial);
View
@@ -101,7 +101,9 @@ bool ShaderManager::loadProgram(string material)
for (unsigned int i = 1; i <= 3; i++)
{
- mat.textureUniforms.push_back( glGetUniformLocation(mat.program, "texture" + i) );
+ ostringstream uniformName;
+ uniformName << "texture" << i;
+ mat.textureUniforms.push_back( glGetUniformLocation(mat.program, uniformName.str().c_str()) );
}
// Nacist textury

0 comments on commit 21bed7d

Please sign in to comment.