Instantly share code, notes, and snippets.

Embed
What would you like to do?
drawSolidRect issue
void MultipassShader::drawShaderInFBO( const Rectf &r, const gl::GlslProgRef &shader, const gl::FboRef &fbo, int index ) {
if ( fbo != nullptr ) {
fbo->bindFramebuffer();
gl::printError( "bindFBO" );
}
gl::ScopedGlslProg scopedShader( shader );
// Bind textures from other buffers
int textureIndex = 1;
for (unsigned int j = 0; j < mFbos.size(); j++) {
if (index != j) {
mFbos[j]->getColorTexture()->bind( textureIndex );
gl::printError( "bindTexture" );
shader->uniform( "u_buffer" + std::to_string( j ), textureIndex );
textureIndex++;
}
}
// Set uniforms, including external textures
mSetUniforms( shader, textureIndex );
gl::printError( "setUniforms" );
// Draw
gl::drawSolidRect( r );
gl::printError( "drawSolidRect" );
// Unbind textures & FBO
for (unsigned int j = 0; j < mFbos.size(); j++) {
if (index != j) {
mFbos[j]->getColorTexture()->unbind();
gl::printError( "unbindTexture" );
}
}
mCleanUp();
if ( fbo != nullptr ) {
fbo->unbindFramebuffer();
gl::printError( "unbindFBO" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment