Why is "glRenderbufferStorageMultisample" giving me an invalid operation error (1282)?
I'm trying to render a scene into a Multisampled FBO with color/depth buffers only (no textures here) & then resolve that Multisampled FBO into a simple FBO that has color/depth textures, but OpenGL just won't let me...
glEnable(GL_MULTISAMPLE);
glGenFramebuffers(1, &m_Id);
glBindFramebuffer(GL_FRAMEBUFFER, m_Id);
glGenRenderbuffers(1, &m_ColorId);
glBindRenderbuffer(GL_RENDERBUFFER, m_ColorId);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, numOfSamples, GL_RGBA8, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_ColorId);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
The line that gives me error is "glRenderbufferStorageMultisample", interestingly enough though "glRenderbufferStorage" doesn't...
According to the documentation at: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glRenderbufferStorageMultisample.xhtml, you should check the values of your parameters (used for the glRenderbufferStorageMultisample
call against) some OpenGL macros.
Based on the details provided, a check on numOfSamples
value (currently 32) it's my best suggestion. I believe it may be too high.
The maximum value for numOfSamples
may be even limited by the capabilities of your video card.
Hope this may help, Stefano