Open simongeilfus opened 8 years ago
It would be a very welcome update to get at least some of these changes merged into Cinder. Nice work!
Thanks, it's great Fbo is getting some love. (-;
Not sure this is useful "generally", but for my purposes it would have been useful to have:
ability to bind the resolved part of a multisampled Fbo, using the Cinder Fbo API. Normally, when you bindFramebuffer()
(it seems to assume you're binding in order to draw to it, even if you pass the READ
target), it binds the multisampled framebuffer (which is what getId()
returns if the Fbo has multisampling). Luckily, the method getResolveId()
existed, so I could do what I needed directly with raw OGL calls (as long as I was careful to restore Cinder's framebuffer binding state after changing it under the covers).
related to the above: When you call bindFramebuffer()
with the GL_READ_FRAMEBUFFER
target, it perhaps shouldn't call markAsDirty()
(ref), since you're only going to be using it as a source.
BTW, above, when I say "what I needed," I mean: the ability to blit the resolved part of a multisampled Fbo to a different (non-multisampled) Fbo. In my case, I was doing that using an OpenGL extension blit function (glMulticastBlitFramebufferNV()
) to transfer it between GPUs.
In my case, I'm not using any extra (color) attachments, so I didn't need to change read/draw buffers for the Fbo blit stuff I was doing (using glDrawBuffers()
or glReadBuffer()
). However, it might be necessary in some cases, if you had multiple attachments. Is it possible to get/enumerate the attachments (mAttachments*
entries) once you've created an Fbo? Doesn't seem to be. (NOTE: This is not important for me in this case, mainly just a curiosity...don't worry about it!)
I'm not sure any of this warrants complicating Fbo -- e.g. for different bind cases for READ vs DRAW -- but just thought I'd add my comments here in case they are useful or spark any thoughts. Thanks!
https://github.com/simongeilfus/Cinder/tree/TexturesAndFbos
Changes / Additions
gl/Texture
gl::TextureBase::Format::setSamples
gl::TextureBase::Format::getSamples
gl::Texture2d::Format::samples
gl::Texture3d::Format::samples
gl/Fbo
gl::Fbo::createEmpty
(see https://github.com/cinder/Cinder/issues/1191)gl::Fbo multisampling support for texture2dArray
(see https://github.com/cinder/Cinder/issues/1191)gl::Fbo::Format::depthTexture
doesn't supportGL_DEPTH_STENCIL
format (see https://github.com/cinder/Cinder/issues/1501)gl::Fbo better support for textureCubemap
(see https://github.com/cinder/Cinder/issues/1320 and https://forum.libcinder.org/#Topic/23286000002501045)gl::Fbo better support for texture3d and texture2dArray
(see https://github.com/cinder/Cinder/issues/1191)gl::Fbo::attach
gl::Fbo::attach multisampling support
gl::Fbo::Format option to switch to texture based multisampling
static gl::Fbo::checkStatus
gl/wrapper
gl::framebufferRenderbuffer
gl::framebufferTexture
gl::frameBufferTextureLayer
gl::drawBuffers( const std::vector<GLenum> &bufs );
gl::getMaxSamples
gl::getMaxColorTextureSamples
gl::getMaxDepthTextureSamples
gl/scoped
gl::ScopedDrawBuffers
(see https://github.com/cinder/Cinder/issues/736)gl/Environment
gl::Environment::supportsTextureMultisample
gl::Environment::supportsTextureStorageMultisample
gl/platform
CINDER_GL_HAS_TEXTURE_MULTISAMPLE
CINDER_GL_HAS_TEXTURE_2D_STORAGE_MULTISAMPLE
CINDER_GL_HAS_TEXTURE_3D_STORAGE_MULTISAMPLE
tests/_opengl
Related pull requests
Notes
Textures Multisample support :