mystery/src/graphics/shader.cpp
// gets the uniform location and returns it
gets the uniform location and returns it
gets the uniform location and returns it
int Shader::GetUniformLocation(const std::string& name)
		{
			if (m_LocationCache.find(name) != m_LocationCache.end()) {
				return m_LocationCache[name];
			}
			else {
				int location = glGetUniformLocation(m_ShaderId, name.c_str());
				if (location == -1)
					std::cout << "WARNING: uniform" << name << "doesn't exist! " << std::endl;
				m_LocationCache[name] = location;
				return location;
			}
		}
int Shader :: GetUniformLocation ( const std :: string & name ) { if ( m_LocationCache . find ( name ) != m_LocationCache . end ( ) ) { return m_LocationCache [ name ] ; } else { int location = glGetUniformLocation ( m_ShaderId , name . c_str ( ) ) ; if ( location == -1 ) std :: cout << " " << name << " " << std :: endl ; m_LocationCache [ name ] = location ; return location ; } }
gets the uniform location and returns it
gets the uniform location and returns it
// if this location is in the cache, then just return it // otherwise get the uniform location and store it in the cache