Does anyone know if Ogre supports using render buffers as attachments to FBO's instead of textures?
I've been trying to get opencl to work with Ogre rendering to texture for about a week now, and I can make it work with render to texture via PBuffers but there seems to be some kind of incompatibility with FBO textures. I've probed the source code quite a bit in the debugger to find out if it was some kind of mistake on my side but couldn't come up with anything. The Render to texture works fine with FBOs inside ogre (say if I render that texture on a rectangle), but the resulting texture I get in opencl is wrong.
Funnily enough I tried blitting the resulting texture (rtt with FBO) to another "normal" texture (e.g TU_DYNAMIC), and that works fine. However, the blitting is super slow as it goes through the CPU. Looking into the source code I saw this in the blit implementation:
Code: Select all
void GLTextureBuffer::blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox)
{
GLTextureBuffer *srct = static_cast<GLTextureBuffer *>(src.getPointer());
/// Check for FBO support first
/// Destination texture must be 1D, 2D, 3D, or Cube
/// Source texture must be 1D, 2D or 3D
// This does not seem to work for RTTs after the first update
// I have no idea why! For the moment, disable
if(GLEW_EXT_framebuffer_object && (src->getUsage() & TU_RENDERTARGET) == 0 &&
(srct->mTarget==GL_TEXTURE_1D||srct->mTarget==GL_TEXTURE_2D
||srct->mTarget==GL_TEXTURE_3D)&&mTarget!=GL_TEXTURE_2D_ARRAY_EXT)
{
blitFromTexture(srct, srcBox, dstBox);
}
else
{
GLHardwarePixelBuffer::blit(src, srcBox, dstBox);
}
}
