I'm using SDL2 on Windows 10 to create an OpenGL context, but when I try to get the framebuffer attachment color encoding on an Intel UHD 630, I get an Invalid Operation error instead. On my Nvidia Geforce 1070, it's returning the correct value (GL_LINEAR).
According to Khronos, my code should work:
checkGlErrors(); // no error
auto params = GLint{ 0 };
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER,
GL_BACK,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,
¶ms);
checkGlErrors(); // invalid operation
What I'm reading is that Intel drivers are notoriously unreliable, but I'll be surprised if they don't support an SRGB framebuffer. For context: I'm using GL_FRAMEBUFFER_SRGB for gamma correction, and this too doesn't work on my integrated GPU even though it works perfectly on my Nvidia GPU.
Am I doing something wrong? Is there a reliable way of enabling SRGB on the default framebuffer? My drivers are up to date (27.10.100.8425). The output is gamma-corrected on my Geforce GPU but the integrated Intel GPU is rendering the default framebuffer without gamma correction, so I'm assuming there's something unique about the default framebuffer in the Intel drivers that I don't know.
Edit: The correct value should be GL_SRGB, not GL_LINEAR. The correct code for getting that parameter:
// default framebuffer, using glGetFramebuffer
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, ¶ms);
// default framebuffer, using glGetNamedFramebuffer
glGetNamedFramebufferAttachmentParameteriv(GL_ZERO, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, ¶ms);
// named framebuffer
glGetNamedFramebufferAttachmentParameteriv(namedFramebuffer.getId(), GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, ¶ms);