I tried to render to a framebuffer similar to what can be found here, I cannot seem to be able to use the created framebuffer at all for some reason, even with a “dummy shader” that writes a specific color to the buffer I cannot seem to get anything out of it. It’s like either the framebuffer somehow doesn’t exist yet does not cause issues on the driver side, or I bind then unbind it the wrong way for some reason despite copying the code from the tutorial. Same if I turn off the depth testing.
Are you doing this?
Are there any GL errors being thrown?
Forget explicitly drawing to the FBO for a minute. Can you just “clear” its color buffer to a constant color and see that working in the result? Try different colors.
If that works, you know you’ve got it bound as the active GL_DRAW_FRAMEBUFFER
properly. So you can look at how you’re drawing to it. If that doesn’t work, then you probably don’t even have that FBO bound properly (or at least at the right times).
It seems the issue is when I try to bind the framebuffer with the line:
glBindFramebuffer(GL_FRAMEBUFFER, gl_FrameBuffer[updatedBuffer]);
And I get the error code 1280 (bad enum) regardless of which framebuffer enum I’m using in the line. The code which generates the framebuffer does not have this issue.
EDIT: It seems that bad enum issue was with a texture loader I wrote, but still couldn’t fix the issue with the framebuffer.
Ok, so you’re seeing a GL error. But it sounds like you might be unsure exactly “which” GL call threw that error.
In that case, do this:
If you’re using NVIDIA drivers, and you disable their “Threaded Optimization” option (which is anything but) in NVIDIA Control Panel → Manage 3D Settings, then your app will literally be interrupted with this GL message callback inside of the GL call which triggered the GL error to be thrown. This makes it absolutely trivial to determined “who dun it”!
(IIRC, I think that LearnOpenGL link above mentions this method too.)
I’m now on my own way to get wglCreateContextAttribsARB, then my job will be much easier. I just need to know what library do I need to add to the linker.
You don’t. wglCreateContextAttribsARB
isn’t exported by any DLL. You need to use wglGetProcAddress
to obtain a pointer to that function.
Note that you need to already have a context bound in order to use wglGetProcAddress
. So you have to first use wglCreateContext
to create a “bootstrap” context in order to be able to call wglGetProcAddress
to get the pointer to wglCreateContextAttribsARB
which you can then use to create the “real” context(s).