Hi
I've been working on a cube map generator with custom blurred
mipmap levels.
The following code produce correct results:
-
GLuint
id = fbo->getTextureCubeMap()->getId();
-
glFramebufferTexture2D(
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_CUBE_MAP_POSITIVE_X + dir, id, level );
But when I try to substitute lines 1-2 with the following more
elegant Cinder function it does not work:
-
fbo->bindFramebufferFace(
GL_TEXTURE_CUBE_MAP_POSITIVE_X + dir, level );
My custom generated mipmap faces are overwritten by the glGenerateMipmap because
of the markAsDirty() function inside the
bindFramebuffer()
function I suspect.
I noticed that the
markAsDirty() is called twice once in
bindFramebuffer()
and again inside
context()->bindFramebuffer()
If I comment out
both
markAsDirty()
calls it still does not
work as expected.
But if I change the
following line:
-
glFramebufferTexture2D(
target, attachment, faceTarget, mTextureCubeMap->getId(),
level );
To:
-
glFramebufferTexture2D(
target, attachment,
faceTarget, this->getTextureCubeMap()->getId(),
level );
I get
correct results.
To
recap if I comment out both markAsDirty()
function calls and
change the texture ID I get the expected results.
But this off
course breaks all other Fbos.
I'm on OS X using
Cinder 0.9.0
-Tobias