Magnum::GL::defaultFramebuffer
turns into undefined? (when previously complete)
It seems the moment I
frame_buffer->attachRenderbuffer(
Magnum::GL::Framebuffer::BufferAttachment::Depth, *depth_buffer);
the defaultframebuffer turns undefined - would anyone have any hunches?
frame_buffer->attachTexture(
Magnum::GL::Framebuffer::ColorAttachment{ 0 }, *rendertex, 0);
const auto rendertex = std::make_shared<Magnum::GL::Texture2D>();
rendertex->setStorage(1, Magnum::GL::TextureFormat::RGBA8, { render_w, render_h });
rendertex->setWrapping(Magnum::SamplerWrapping::ClampToEdge);
It actually seems like the moment I do this
const auto frame_buffer = std::make_shared<Magnum::GL::Framebuffer>(Magnum::Range2Di{ {}, { render_w, render_h } });
we get the undefined.
@mosra
undefined
Magnum::GL::defaultFramebuffer.checkStatus for both read/draw return undefined
GL::defaultFramebuffer
but instead query the real framebuffer ID , GL::Framebuffer::wrap()
it and use that instead
query the real framebuffer ID
How would I do this?
diff --git a/src/Magnum/GL/Implementation/FramebufferState.cpp b/src/Magnum/GL/Implementation/FramebufferState.cpp
index 38f48883c..43dcca79c 100644
--- a/src/Magnum/GL/Implementation/FramebufferState.cpp
+++ b/src/Magnum/GL/Implementation/FramebufferState.cpp
@@ -39,7 +39,7 @@ using namespace Containers::Literals;
constexpr const Range2Di FramebufferState::DisengagedViewport;
-FramebufferState::FramebufferState(Context& context, Containers::StaticArrayView<Implementation::ExtensionCount, const char*> extensions): readBinding{0}, drawBinding{0}, renderbufferBinding{0}, maxDrawBuffers{0}, maxColorAttachments{0}, maxRenderbufferSize{0},
+FramebufferState::FramebufferState(Context& context, Containers::StaticArrayView<Implementation::ExtensionCount, const char*> extensions): readBinding{State::DisengagedBinding}, drawBinding{State::DisengagedBinding}, renderbufferBinding{0}, maxDrawBuffers{0}, maxColorAttachments{0}, maxRenderbufferSize{0},
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
maxSamples{0},
#endif
How would I do this?
this seems to be the way: https://stackoverflow.com/a/9755439 (no, magnum doesn't have such getters on its own)
so at the start, what magnum thinks is a default framebuffer, is some other FB
Just to confirm, so what magnum thinks is a default framebuffer, is still a valid framebuffer, just not the default one?
GL_FRAMEBUFFER_BINDING_OES
What header do I need to include to get this?
GL_FRAMEBUFFER_BINDING
, then? GL_FRAMEBUFFER_DRAW_BINDING
? something along those lines?
what magnum thinks is a default framebuffer, is still a valid framebuffer, just not the default one?
exactly, and the state tracker thinks it's the default one because that's what it usually is on other platforms
@mosra
GL_FRAMEBUFFER_BINDING
Seems we might be moving forward. I now realise that I getGL::Renderer::Error::InvalidOperation
errors each time I run SDL2Application::swapBuffers()
on ios - any hunches?
GLint defaultFBO_index;
/*glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &defaultFBO);*/
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO_index);
Magnum::Debug{} << "default framebuffer index: " << defaultFBO_index;
const auto viewport = Magnum::GL::defaultFramebuffer.viewport();
_default_frame_buffer = std::make_unique< Magnum::GL::Framebuffer>(
Magnum::GL::Framebuffer::wrap(defaultFBO_index, viewport)
);
xcode opengl debugger
Didn't know that existed either - will look it up!
_default_frame_buffer.bind()
before swapBuffers(), does it fix the error?
glBindFramebuffer(GL_READ_FRAMEBUFFER, _default_frame_buffer.id());
instead :sweat_smile:
Attempted present of non-layer backed renderbuffer
glBindRenderbuffer
!