Alex Holkner wrote:
> Some of the OpenGL support I mentioned is here:
> http://www.opengl.org/registry/specs/EXT/framebuffer_sRGB.txt.  It
> assumes an output gamma of 2.2.
> 
> It sounds like you have control over the rendering machine, in which
> case rendering to a linear framebuffer and using the device driver's
> configuration tool to calibrate the display seems more appropriate.
> 
> Cheers
> Alex.

Alex,

I take it you mean setting the gamma in the graphics card's settings 
dialog? Sure, that would work, but I want to do it programmatically, not 
manually. I only want to temporarily change the gamma for the screen 
while I'm displaying stuff in a pyglet window. When I'm done, I want it 
to change back to its normal gamma. Otherwise I end up with a saturated 
desktop (sometimes games fail to reset gamma when they exit, that can be 
really annoying).

I followed Andrew's tip, and tried GetDeviceGammaRamp and 
SetDeviceGammaRamp in win32, but I couldn't seem to get them to work. 
The code is attached. Return values for both 
windll.gdi32.GetDeviceGammaRamp and windll.gdi32.SetDeviceGammaRamp are 
0 for me. I don't know much about ctypes and windows calls, so I'm 
probably doing something wrong.

Cheers,

Martin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

from ctypes import *
import pyglet.window

win = pyglet.window.Window()

# try and get gamma ramp
# see http://msdn2.microsoft.com/en-us/library/ms536834.aspx
buf = create_string_buffer(256*3) # R, G, and B ramps
ret = windll.gdi32.GetDeviceGammaRamp(win.context._context, byref(buf))
print ret

# try and set gamma ramp
# see http://msdn2.microsoft.com/en-us/library/ms536529.aspx
ret = windll.gdi32.SetDeviceGammaRamp(win.context._context, byref(buf))
print ret

Reply via email to