OS wide gamma correction Part 2.
After writing a simple program that patches LoadRGB4 and LoadRGB32 to apply gamma correction, which works fine, I tried to patch GetRGB32 so that it can return the original color values. Because LoadRGB32 takes 32bit values for each component, I assumed that these were just stored as is, so that I could store the original values in that (gamma corrected byte, original byte, two zero bytes). Turns out that only the top byte of each component is actually used, the rest is discarded (missed it in the docs).
Major pain :scream Other than storing a color table for each viewport, does anyone have any ideas as how to get GetRGB32 to return the original, uncorrected color values? Note that gamma correction is lossy, so you can't just reverse it. Perhaps the LoadRGB functions shouldn't be patched, but something else? |
Quote:
Or bin your old monitor and get one that does not need gamma correction :D |
Quote:
Seems worth looking at, thanks. Quote:
|
Turns out you don't have to mess with the copper lists (thank goodness).
Basic steps: 1. Patch makevport by copying the colortable over and applying the gamma correction to the copy. Have makevport use the copy, and restore the original pointer. 2. Patch loadrgb32 to set gamma corrected colors. Make a new color table with the original colors. 3. Done :) ...or so it seems ;) |
Good news. The trick seems to be catching the color data right before the coplist is made, so u don't have to store original colors. At least it was what made me suggest getting to a lower level...
|
It mostly works. Grabbed screens use original colors, etc. There's still a problem. Some screens don't get corrected. Probably something small.
|
It seems that it's impossible to get it to work completely properly like this :scream The OS probably just sticks the colors directly into the copperlist. If only it was possible to safely call this routine.
Guess it's time to look into changing a viewport's copperlist manually. Hopefully that will be a little easier than I thought. |
All times are GMT +2. The time now is 15:08. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.