Пример #1
0
void ShaderProgram::addUniformf(const std::string& name, const std::initializer_list<GLfloat*> v)
{
	auto a = new GLfloat*[v.size()];
	int i = 0;
	for (GLfloat* f : v)
		a[i++] = f;
	uniformsf[name] = { glGetUniformLocation(program, name.c_str()), a, v.size() };
	glUseProgram(program);
	updateUniform(uniformsf[name]);
}
Пример #2
0
void Shader::updateProgram()
{
	while (!m_dirtyUniforms.empty())
	{
		UniLocPair& top = m_dirtyUniforms.front();

		Uniform* currUniform = top.first;
		GLuint currLoc = top.second;

		updateUniform(currUniform, currLoc);
		m_dirtyUniforms.pop_front();
	}
}
Пример #3
0
void ShaderProgram::use(const std::initializer_list<std::string> v)
{
	use();
	for (const std::string& u : v)
		updateUniform(uniformsf[u]);
}