Setting the GammaRamp

Hi,

I’m trying to apply a specific gamma ramp to the display adapter. The
Win32 API call “SetDeviceGammaRamp” won’t do, because like the
documentation says:

“SetDeviceGammaRamp doesn’t allow all gamma ramps. It checks the gamma
ramp; if it is too complex such as red flash when the player is shot in
Quake, it rejects it”

The DirectDraw call “IDirectDrawGammaControl” would accept all gamma
ramps, but since I will use an OpenGL application, this is not an option.
But since DirectDraw can do it, I thought of setting the gamma ramp
directly (without GDI) to the hardware. I think “DrvIcmSetDeviceGammaRamp”
might be the right call, but I have no idea, where I can get the wanted
parameters (besides the ramp), nor how to send this call to the display
driver.

Any idea or other solution is welcome :slight_smile:

René
r.berndt@tu-bs.de

I’m a bit rusty on this, but chances are that your typical OpenGL ICD does
not go through the display driver to do this kind of thing anyway, no ?
Besides, color is just color, red, green, blue. So, maybe you can just as
well include gamma computations in your color or lighting module. That’s
even more the case if you want your program to work on some flavor of OpenGL
that takes advantage of direct rendering.

Alberto.

-----Original Message-----
From: r.berndt@tu-bs.de [mailto:r.berndt@tu-bs.de]
Sent: Tuesday, December 10, 2002 10:19 AM
To: NT Developers Interest List
Subject: [ntdev] Setting the GammaRamp

Hi,

I’m trying to apply a specific gamma ramp to the display adapter. The
Win32 API call “SetDeviceGammaRamp” won’t do, because like the
documentation says:

“SetDeviceGammaRamp doesn’t allow all gamma ramps. It checks the gamma
ramp; if it is too complex such as red flash when the player is shot in
Quake, it rejects it”

The DirectDraw call “IDirectDrawGammaControl” would accept all gamma
ramps, but since I will use an OpenGL application, this is not an option.
But since DirectDraw can do it, I thought of setting the gamma ramp
directly (without GDI) to the hardware. I think “DrvIcmSetDeviceGammaRamp”
might be the right call, but I have no idea, where I can get the wanted
parameters (besides the ramp), nor how to send this call to the display
driver.

Any idea or other solution is welcome :slight_smile:

Ren?
r.berndt@tu-bs.de


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Hi Alberto,

the problem is, that the computer is attached to a projector. If you
simple paint RGB-values from (0,0,0) to (255,0,0), you see that this is
not continuos; you see very ugly gaps in the intensity. The idea was to
adjust these wrong color values with a specific gammaramp. So its more a
local gamma correction on a few positions.

> ramps, but since I will use an OpenGL application, this is not an
option.

Why not use DDraw in OpenGL app?

Max

Mixing up non-OpenGL code with OpenGL code may be a bit of a problem because
of the way some ICDs are implemented.

Alberto.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, December 11, 2002 4:13 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Setting the GammaRamp

ramps, but since I will use an OpenGL application, this is not an
option.

Why not use DDraw in OpenGL app?

Max


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

All the gamma ramp functionality does is to fiddle with colors by software,
hence, it’s just as easy for you to write your own. Some DACs will allow you
to specify gamma correction separate from the mainstream color, but many
don’t, and the interfaces when they exist will probably be proprietary and
hence not accessible to most of us. What you can do is to build the
gammaramp software in your color generation, so that the rgb values you send
to your projector are good for that projector.

The correction is very simple: for each component (red, green, blue) you
compute

corrected color = 255 * (uncorrected color / 255) ^ gamma

You can find a brief but nice explanation at

-----Original Message-----
From: r.berndt@tu-bs.de [mailto:r.berndt@tu-bs.de]
Sent: Wednesday, December 11, 2002 4:46 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Setting the GammaRamp

Hi Alberto,

the problem is, that the computer is attached to a projector. If you
simple paint RGB-values from (0,0,0) to (255,0,0), you see that this is
not continuos; you see very ugly gaps in the intensity. The idea was to
adjust these wrong color values with a specific gammaramp. So its more a
local gamma correction on a few positions.


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Hi,

Sorry for the broken message before, here it goes again.

It’s rather easy to compute the gamma correction yourself before you issue
the colors to your projector, the formula is something like

corrected = uncorrected ^ gamma

where “corrected” and “uncorrected” are your normalized red, green, blue
values, in GLfloat or GLdouble format, from 0.0f to 1.0f. Of course the
value of gamma changes

You can also take a look at

http://www.delphi3d.net/articles/viewarticle.php?article=gamma.htm

where they have a real nice and simple explanation of what you have to do.
There’s a little downloadable example in there, it’s written in Delphi
Pascal but it’s pretty usable as is. You can also take a look at

http://home.inforamp.net/~poynton/GammaFAQ.html/notes/color/GammaFQA.html

There’s lots of information on Gamma in there. You can also look at the WGL
extension for color tables and gamma, it’s described at

http://www.opengl.org/developers/documentation/Version1.2/WINspecs/wgl_displ
ay_color_table.txt?gamma#first_hit

but I’m not sure if any available OpenGL implementation supports it. I also
remember a little OpenGL demo program that fiddled with gamma correction,
but I can’t locate its source.

Hope this helps !

Alberto.

-----Original Message-----
From: r.berndt@tu-bs.de [mailto:r.berndt@tu-bs.de]
Sent: Wednesday, December 11, 2002 4:46 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Setting the GammaRamp

Hi Alberto,

the problem is, that the computer is attached to a projector. If you
simple paint RGB-values from (0,0,0) to (255,0,0), you see that this is
not continuos; you see very ugly gaps in the intensity. The idea was to
adjust these wrong color values with a specific gammaramp. So its more a
local gamma correction on a few positions.


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.