Change the brightness / gamma of the whole scene in OpenGL

Does anyone know how I can achieve the following effect in OpenGL:

  • Changing scene rendering brightness
  • Or implement Gamma customization in OpenGL

I tried to change the ambient light parameter and the type of light (directional and omnidirectional), but the result was uneven. TIA.

Thank you for your help, additional information: * I can not use the Windows specification API. * The gamma setting should not affect the whole window, since I have to have a different gamma for different types.

+3
source share
2 answers

win32 SetDeviceGammaRamp /. , , .

( ), - , . -, ; , , -.

, , , . .

if( brightness > 1 )
{
    glBlendFunc( GL_DEST_COLOR, GL_ONE );
    glColor3f( brightness-1, brightness-1, brightness-1 );
}
else
{
    glBlendFunc( GL_ZERO, GL_SRC_COLOR );
    glColor3f( brightness, brightness, brightness );
}
glEnable( GL_BLEND );

draw_quad();
+3

Source: https://habr.com/ru/post/1697569/


All Articles