SDL_SetGamma not working under Windows

Hi all,
I have just ported the testgamma.c program over to Object Pascal to
test the SDL_SetGamma function call. No one who has tested the resulting
executable on Windows, can see the Gamma manipulation working.
Does testgamma.c work on anyone else’s system? Could someone send me an
exe of testgamma?

Thanks,

Dominique–
http://www.DelphiGamer.com := for all your Object Pascal game
development needs;
http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME := Home of JEDI-SDL;
Cross-platform game development with Pascal, has never been easier.

I can tell you with certainty that it does not work in win32 with certain
video cards. Which ones exactly probably include 3dfx, but I do not know
what else they might include.On Tue, Apr 09, 2002 at 12:23:36AM +0100, Dominique Louis wrote:

I have just ported the testgamma.c program over to Object Pascal to
test the SDL_SetGamma function call. No one who has tested the resulting
executable on Windows, can see the Gamma manipulation working.
Does testgamma.c work on anyone else’s system? Could someone send me an
exe of testgamma?


Joseph Carter The guy with a rocket launcher

LWE?
Linux W?? E??
will eatyou
World Expo?
i see

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020408/f66bd4f9/attachment.pgp

Hi Joseph,
From what I can tell the call to SDL_SetGamma always fails. I am using
a Dell Laptop which I definately know supports gamma ramping and it
fails onthe following line…

gamma := 1.0;
if ( SDL_SetGamma(gamma, gamma, gamma) < 0 )  // <--- always returns 

less than zero
{
fprintf(stderr, ‘Unable to set gamma: %s\n’, SDL_GetError());
exit(1);
}

Can Sam or anyone else shed some light on this problem?

Thanks,

Dominique.

Joseph Carter wrote:>On Tue, Apr 09, 2002 at 12:23:36AM +0100, Dominique Louis wrote:

I have just ported the testgamma.c program over to Object Pascal to
test the SDL_SetGamma function call. No one who has tested the resulting
executable on Windows, can see the Gamma manipulation working.
Does testgamma.c work on anyone else’s system? Could someone send me an
exe of testgamma?

I can tell you with certainty that it does not work in win32 with certain
video cards. Which ones exactly probably include 3dfx, but I do not know
what else they might include.

Whats “:=” ? Not straight C then?

Lund

Dominique Louis wrote:> Hi Joseph,

From what I can tell the call to SDL_SetGamma always fails. I am using
a Dell Laptop which I definately know supports gamma ramping and it
fails onthe following line…

gamma := 1.0;
if ( SDL_SetGamma(gamma, gamma, gamma) < 0 ) // <— always returns
less than zero
{
fprintf(stderr, ‘Unable to set gamma: %s\n’, SDL_GetError());
exit(1);
}

Can Sam or anyone else shed some light on this problem?

Thanks,

Dominique.

Joseph Carter wrote:

On Tue, Apr 09, 2002 at 12:23:36AM +0100, Dominique Louis wrote:

I have just ported the testgamma.c program over to Object Pascal to
test the SDL_SetGamma function call. No one who has tested the
resulting executable on Windows, can see the Gamma manipulation working.
Does testgamma.c work on anyone else’s system? Could someone send me
an exe of testgamma?

I can tell you with certainty that it does not work in win32 with certain
video cards. Which ones exactly probably include 3dfx, but I do not know
what else they might include.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Jorgen “Lord” Lundman <@Jorgen_Lundman>
Technology Manager, Unix Administrator
Phone: +44 (0)20-86591860 Mobile: +44 (0)79-58642918
Pager: 07958642918 at one2one.net
"Rare is the person who can weigh the faults of others
without putting his thumb on the scales": Byron J. Langenfeld

static void DIB_CheckGamma(_THIS)
{
#ifndef NO_GAMMA_SUPPORT
HDC hdc;
WORD ramp[3*256];

/* If we fail to get gamma, disable gamma control */
hdc = GetDC(SDL_Window);
if ( ! GetDeviceGammaRamp(hdc, ramp) ) {
    this->GetGammaRamp = NULL;
    this->SetGammaRamp = NULL;
}
ReleaseDC(SDL_Window, hdc);

#endif /* !NO_GAMMA_SUPPORT */
}

If this code is failing (you might add some debug output or something
maybe?) that would explain it. In what cases this code succeeds though, I
can’t guess.

The windx5 directory has a much messier set of DirectDraw gamma code, but
that doesn’t even work with OpenGL windows since they don’t have DDraw
contexts. Sam, could you add GetDeviceGammaRamp/SetDeviceGammaRamp
support to the windx5 backend for non-DDraw windows? Looks easy enough to
do, but without a winbox to test on, I’m hesitant to touch it.On Tue, Apr 09, 2002 at 11:02:37AM +0100, Dominique Louis wrote:

Hi Joseph,
From what I can tell the call to SDL_SetGamma always fails. I am using
a Dell Laptop which I definately know supports gamma ramping and it
fails onthe following line…

gamma := 1.0;
if ( SDL_SetGamma(gamma, gamma, gamma) < 0 ) // <— always returns
less than zero
{
fprintf(stderr, ‘Unable to set gamma: %s\n’, SDL_GetError());
exit(1);
}

Can Sam or anyone else shed some light on this problem?


Joseph Carter Have chainsaw will travel

  • wichert_ imagines master without a MTA
    wichert: ehm? that might hinder peformance of the BTS :stuck_out_tongue:

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020409/88dcc212/attachment.pgp

Hi Jorgen,

Jorgen Lundman wrote:

Whats “:=” ? Not straight C then?

That should obviously be just = . I was converting my code back to C (
from Pascal ) and didn’t remove the the semi-colon.

Havinh looked through the SDL_Gamma.c code, could it be that the Windows
version is not compiled with USE_MATH_H compiler derective and thus it
is falling through to the #else which says…
SDL_SetError(“Gamma correction not supported”);

Which is the error message I am getting.

Any C experts out that that can confirm this?

Thanks,

Dominique.

static void DIB_CheckGamma(_THIS)
{
#ifndef NO_GAMMA_SUPPORT
HDC hdc;
WORD ramp[3*256];

/* If we fail to get gamma, disable gamma control */
hdc = GetDC(SDL_Window);
if ( ! GetDeviceGammaRamp(hdc, ramp) ) {
    this->GetGammaRamp = NULL;
    this->SetGammaRamp = NULL;
}
ReleaseDC(SDL_Window, hdc);

#endif /* !NO_GAMMA_SUPPORT */
}

If this code is failing (you might add some debug output or something
maybe?) that would explain it. In what cases this code succeeds though, I
can’t guess.

The windx5 directory has a much messier set of DirectDraw gamma code, but
that doesn’t even work with OpenGL windows since they don’t have DDraw
contexts. Sam, could you add GetDeviceGammaRamp/SetDeviceGammaRamp
support to the windx5 backend for non-DDraw windows? Looks easy enough to
do, but without a winbox to test on, I’m hesitant to touch it.

It’s not trivial. There’s a whole bunch of code and associated data
relating to saving and restoring the gamma ramp which is specific to
the DIB version of the driver. The whole “fake-DIB-with-OpenGL” hack
really needs to be redesigned properly with SDL 1.3.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

OpenGL is neither a DIB, nor is it a DDraw context. It is, however, a DC
and the gamma function used by the DIB context is far more correct. I’ll
see what I can do about it (Or ask Forest to pound something into on his
winbox), but it absolutely sucks that nobody using SDL in OpenGL (which
defaults to windx5) manages to get gamma correction support. =(

Some games, especially older ones, really need it.On Tue, Apr 09, 2002 at 09:29:14AM -0700, Sam Lantinga wrote:

static void DIB_CheckGamma(_THIS)
{
#ifndef NO_GAMMA_SUPPORT
HDC hdc;
WORD ramp[3*256];

/* If we fail to get gamma, disable gamma control */
hdc = GetDC(SDL_Window);
if ( ! GetDeviceGammaRamp(hdc, ramp) ) {
    this->GetGammaRamp = NULL;
    this->SetGammaRamp = NULL;
}
ReleaseDC(SDL_Window, hdc);

#endif /* !NO_GAMMA_SUPPORT */
}

If this code is failing (you might add some debug output or something
maybe?) that would explain it. In what cases this code succeeds though, I
can’t guess.

The windx5 directory has a much messier set of DirectDraw gamma code, but
that doesn’t even work with OpenGL windows since they don’t have DDraw
contexts. Sam, could you add GetDeviceGammaRamp/SetDeviceGammaRamp
support to the windx5 backend for non-DDraw windows? Looks easy enough to
do, but without a winbox to test on, I’m hesitant to touch it.

It’s not trivial. There’s a whole bunch of code and associated data
relating to saving and restoring the gamma ramp which is specific to
the DIB version of the driver. The whole “fake-DIB-with-OpenGL” hack
really needs to be redesigned properly with SDL 1.3.


Joseph Carter Sooner or later, BOOM!

you GPL your homework? :slight_smile:
yah =D
Anyone is permitted to use or modify my homework, but if they
distribute changes they must include the full machine-readable
source code ;>

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020409/b6b5c982/attachment.pgp

Sam Lantinga wrote:

static void DIB_CheckGamma(_THIS)
{
#ifndef NO_GAMMA_SUPPORT

It’s not trivial. There’s a whole bunch of code and associated data
relating to saving and restoring the gamma ramp which is specific to
the DIB version of the driver. The whole “fake-DIB-with-OpenGL” hack
really needs to be redesigned properly with SDL 1.3.

Speaking about GAMMA support - would it be possible to support
XV_BRIGHTNESS and other simmilar attributes in some way - currently
I had to use some hacks (private structures) to get even
to xv_port number which is hidden–
.’’. Which fundamental human right do you want to give up today? : :' : Debian GNU/Linux maintainer - www.debian.{org,cz}. ' Zdenek Kabelac kabi@{debian.org, users.sf.net, fi.muni.cz}- When in doubt, just blame the Euro. :slight_smile: