Skip to content
  • DarkGod's avatar
    Merge branch 'screenshot-issues' into 'master' · f036030a
    DarkGod authored
    Screenshot issue fixes
    
    1. Fix save dialog appearing in savefile screenshot.  
    Don't swap buffers when rendering for screenshots, since glReadPixels reads the back buffer.
    
    1. Fix positioning for savefile screenshot.  
    Needed to flip the Y-coordinate due to coordinate system differences between SDL and OpenGL.
    
    1. Fix to not gamma adjust pixels of savefile screenshots when using shaders.  
    Savefile screenshots looked to bright on the load game dialog because the pixels were saved with the gamma already applied.  The gamma got applied again when displayed.
    
        Note: There is a lingering gamma adjustment made in game/modules/tome/class/Game.lua with the comment "Reset gamma setting, something somewhere is disrupting it, this is a stop gap solution".  I left this adjustment in when not doing a savefile screenshot, although I don't see why it's necessary.
    
    1. Simplify SDL gamma calculation and restore default gamma on exit.  
    When testing with shaders off, the gamma for the entire display would be changed and not restored on exit.  Fixed that and also simplified the calculation to just use SDL_SetWindowBrightness, which calculates a simple gamma ramp behind the scenes.
    
    1. Fix to gamma adjust pixels of user screenshots when not using shaders.  
    Unlike savefile screenshots, user screenshots are meant to be displayed outside the game.  They should have the gamma applied to the pixels so the picture will reflect what the game looked like when the screenshot was taken.  When shaders are used for gamma, this happens by default.  When shaders are not used, the gamma adjustment must be made to the pixel values during the save.
    
    See merge request !522
    f036030a