Request sRGB-capable visual during creating OpenGL context.

We need it for proper working. When it's not available, then function glEnable(GL_FRAMEBUFFER_SRGB) doesn't take any effect, and then displayed image is too dark.

It doesn't solve the issue that the screen is too dark for intel graphics cards on linux, because the driver ignores this request. But still, this is the proper way to do it and it may avoid similar issues in future.

Actually we should detect that the visual is not srgb-capable, and in this case maybe make some gamma correction or filter it on our side to get similar effect.
This commit is contained in:
Deve 2015-12-10 20:58:51 +01:00
parent 8f6a529531
commit 0216fd9697
2 changed files with 11 additions and 10 deletions

View File

@ -645,11 +645,11 @@ bool CIrrDeviceLinux::createWindow()
GLX_SAMPLE_BUFFERS_SGIS, 1, GLX_SAMPLE_BUFFERS_SGIS, 1,
GLX_SAMPLES_SGIS, CreationParams.AntiAlias, // 18,19 GLX_SAMPLES_SGIS, CreationParams.AntiAlias, // 18,19
#endif #endif
//#ifdef GL_ARB_framebuffer_sRGB #ifdef GLX_ARB_framebuffer_sRGB
// GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, CreationParams.HandleSRGB, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, CreationParams.HandleSRGB,
//#elif defined(GL_EXT_framebuffer_sRGB) #elif defined(GLX_EXT_framebuffer_sRGB)
// GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, CreationParams.HandleSRGB, GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, CreationParams.HandleSRGB,
//#endif #endif
GLX_STEREO, CreationParams.Stereobuffer?True:False, GLX_STEREO, CreationParams.Stereobuffer?True:False,
None None
}; };
@ -796,11 +796,11 @@ bool CIrrDeviceLinux::createWindow()
// GLX_USE_GL, which is silently ignored by glXChooseVisual // GLX_USE_GL, which is silently ignored by glXChooseVisual
CreationParams.Doublebuffer?GLX_DOUBLEBUFFER:GLX_USE_GL, // 14 CreationParams.Doublebuffer?GLX_DOUBLEBUFFER:GLX_USE_GL, // 14
CreationParams.Stereobuffer?GLX_STEREO:GLX_USE_GL, // 15 CreationParams.Stereobuffer?GLX_STEREO:GLX_USE_GL, // 15
//#ifdef GL_ARB_framebuffer_sRGB #ifdef GLX_ARB_framebuffer_sRGB
// CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB:GLX_USE_GL, CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB:GLX_USE_GL,
//#elif defined(GL_EXT_framebuffer_sRGB) #elif defined(GLX_EXT_framebuffer_sRGB)
// CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT:GLX_USE_GL, CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT:GLX_USE_GL,
//#endif #endif
None None
}; };

View File

@ -449,6 +449,7 @@ void IrrDriver::initDevice()
params.WindowSize = params.WindowSize =
core::dimension2du(UserConfigParams::m_width, core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height); UserConfigParams::m_height);
params.HandleSRGB = true;
/* /*
switch ((int)UserConfigParams::m_antialiasing) switch ((int)UserConfigParams::m_antialiasing)