Hello all,
I’m sorry for this obviously remedial question, but I’ve been having problems binding a texture to use with drawSolidRect(). I know I"m missing something completely obvious, but after hours of looking, I feel like I’m getting further from where i need to be. Here is the pertinent code:
void GLBlurTestApp::setup()
{
auto fmt = gl::Fbo::Format().samples(4).attachment(GL_COLOR_ATTACHMENT0,
gl::Texture2d::create(FBOW,FBOH,gl::Texture2d::Format().internalFormat(GL_RGB8)));
mFBO = gl::Fbo::create(FBOW, FBOH, fmt);
blurFBO = gl::Fbo::create(FBOW, FBOH, fmt);
try{
mBlur = gl::GlslProg::create(gl::GlslProg::Format().vertex(loadAsset("../data/blur_vert.glsl"))
.fragment(loadAsset("../data/blur_frag.glsl")));
}
catch (const std::exception& exc)
{
console() << "SHADER FAILED 'cause: " << exc.what();
}
}
void GLBlurTestApp::draw()
{
gl::clear( Color( 0, 0, 0.25 ) );
gl::draw(mFBO->getColorTexture(), Rectf(0, 0, getWindowWidth() / 2, getWindowHeight() / 2));
{
gl::Texture2dRef texref = mFBO->getTexture2d(GL_COLOR_ATTACHMENT0);
gl::ScopedTextureBind tex0(texref,0);
//this just draws white.
gl::drawSolidRect(Rectf(getWindowWidth() / 2, getWindowHeight() / 2, getWindowWidth(), getWindowHeight()),vec2(0,1),vec2(1,0));
//this draws the mFBO texture
gl::draw(texref, Rectf(getWindowWidth() / 2, 0, getWindowWidth(), getWindowHeight() / 2));
}
//CI_CHECK_GL();
}
Which yields an image wherein the gl::drawSolidRect() does not render the texture, rather it simply throws up a white rect:
So: given that the texture information in mFBO clearly exists, what simple stupid thing am I overlooking?
thank you.