|
From: Christopher D. <e.c...@cm...> - 2005-09-06 11:26:17
|
I tried updating an uniform attribute from within Renderable::render with
the mechanisms of shallows, but
void Foo::render() const
{
...
for(size_t i=0; i<m_Nt; i++) {
m_shader->setParam3fv("b", 9, &m_tri_data[i].b[0]);
...
}
}
fails with:
sview: src/GLProgram.cpp:432: GLint
shallows::GLProgram::validate_uniform(const char*) const:
Assertion `it != uniformsNameToType_.end() && "Internal
Shallows error. The uniform map does not correspond with
OpenGL."' failed.
Aborted
However, if I circumvent a little bit by adding
unsigned int getProgramHandle() const { return programHandle_; }
in GLProgram, the following
void Foo::render() const
{
GLint location = glGetUniformLocation(m_shader->getProgramHandle(), "b");
if(location == -1)
throw std::runtime_error("fuuuu");
for(size_t i=0; i<m_Nt; i++) {
glUniform3fv(location, 9, &m_tri_data[i].b[0]);
...
}
}
works like a charm.
Could it be possible to add a back-door to do stuff like this, or does
it completely break with the philosophy? The location index, or at
least the program handle, is also needed for throwing uniform shader
variables into buffer objects.
--
Chris
|