DGA Question

FT Rathore wrote:

HI
I tried SDL and it is really good, finaly I can play Doom on 16bit
Xserver, but I have a couple of question:

  1. How do I enable fullscreen DGA, do I need to set a environment
    variable?. (I am using RH-5.0).

screen = SDL_SetVideoMode(320, 240, 8, SDL_SWSURFACE|SDL_FULLSCREEN);

Where:
320 is the x resolution
240 is the y resolution

8 is bpp

SDL_SWSURFACE specifies system memory
SDL_FULLSCREEN specifies attempt to get fullscreen video.

  1. Is anybody already working on Joystick support for the linux version?

Dunno. Ask Sam -> slouken at devolution.com

  1. Is this the right place to ask this kind of questions.?

Yes.

Thanks
FT

Welcome,

Paul Lowe
xpaull at ultraviolet.org

HI
I tried SDL and it is really good, finaly I can play Doom on 16bit
Xserver, but I have a couple of question:

  1. How do I enable fullscreen DGA, do I need to set a environment
    variable?. (I am using RH-5.0).

  2. Is anybody already working on Joystick support for the linux version?

  3. Is this the right place to ask this kind of questions.?

Thanks
FT

  1. How do I enable fullscreen DGA, do I need to set a environment
    variable?. (I am using RH-5.0).

sdldoom -fullscreen
You’ll need to run it as root to get the fullscreen mode.
Note that there’s a bug in it which will soon be fixed – the screen
shifts when you use the mouse. Dunno why.

  1. Is anybody already working on Joystick support for the linux version?

Yes. Joystick support is planned and will be implemented soon.
(~3 weeks)

  1. Is this the right place to ask this kind of questions.?

Yes. :slight_smile: (Thanks for answering, Paul. :slight_smile:

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Maybe you need the -grabmouse option?
Ciao
-MicheleOn Sat, Oct 17, 1998 at 10:57:58PM -0700, Sam Lantinga wrote:

  1. How do I enable fullscreen DGA, do I need to set a environment
    variable?. (I am using RH-5.0).

sdldoom -fullscreen
You’ll need to run it as root to get the fullscreen mode.
Note that there’s a bug in it which will soon be fixed – the screen
shifts when you use the mouse. Dunno why.

Hi!

I just finished porting Sabre from svgalib to X11 with SDL. The only catch is
all of the colors are really, really dark. Is there some kind of gamma
correction or an easy way up my color brighness ?

thanx,

/dev—
// David E. Vandewalle |Weinberg’s Law: If builders built
// vandewal at skyblue.com | buildings the way programmers wrote
// david.e.vandewalle at lmco.com | programs, then thefirst woodpecker that
// | came along would destroy civilization.

I just finished porting Sabre from svgalib to X11 with SDL. The only catch is
all of the colors are really, really dark. Is there some kind of gamma
correction or an easy way up my color brighness ?

Very cool.

The fast way I know to do this is:

for entry in palette
do entry.r += amount
   entry.g += amount
   entry.b += amount
done

I don’t know how this looks since I’ve just saved my palette out as an xpm
image (don’t ask me how) and used XV to tweak the gamma.

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

I just finished porting Sabre from svgalib to X11 with SDL. The only catch is
all of the colors are really, really dark. Is there some kind of gamma
correction or an easy way up my color brighness ?

Very cool.

The fast way I know to do this is:

for entry in palette
do entry.r += amount
entry.g += amount
entry.b += amount
done

I don’t know how this looks since I’ve just saved my palette out as an xpm
image (don’t ask me how) and used XV to tweak the gamma.

wouldn’t this only work on colormapped displays? ie, it wouldn’t work
with TrueColor visuals?On Sun, 18 Oct 1998, Sam Lantinga wrote:

See ya!
-Sam Lantinga (slouken at devolution.com)


Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/


Scott M. Stone <sstone at pht.com, sstone at turbolinux.com>

Head of TurboLinux Development/Systems Administrator
Pacific HiTech, Inc (USA) / Pacific HiTech, KK (Japan)
http://www.pht.com http://armadillo.pht.co.jp
http://www.pht.co.jp http://www.turbolinux.com

Very cool.

The fast way I know to do this is:

for entry in palette
do entry.r += amount
entry.g += amount
entry.b += amount
done

For RGB I would have thought that
for entry in palette
do entry.r *= 0.99
entry.g *= 0.99
entry.b *= 0.99
done

would like nicer?

njhOn Sun, 18 Oct 1998, Sam Lantinga wrote:

wouldn’t this only work on colormapped displays? ie, it wouldn’t work
with TrueColor visuals?

Why wouldn’t it?

njhOn Mon, 19 Oct 1998, Scott Stone wrote:

wouldn’t this only work on colormapped displays? ie, it wouldn’t work
with TrueColor visuals?

Why wouldn’t it?

Because colormaps don’t work / are irrelevant with TrueColor and
DirectColor visuals. If you try installing a colormap into a TrueColor
display, it doesn’t work, and usually gives an X error.On Mon, 19 Oct 1998, Nathan Hurst wrote:

On Mon, 19 Oct 1998, Scott Stone wrote:


Scott M. Stone <sstone at pht.com, sstone at turbolinux.com>

Head of TurboLinux Development/Systems Administrator
Pacific HiTech, Inc (USA) / Pacific HiTech, KK (Japan)
http://www.pht.com http://armadillo.pht.co.jp
http://www.pht.co.jp http://www.turbolinux.com

Why wouldn’t it?

Because colormaps don’t work / are irrelevant with TrueColor and
DirectColor visuals. If you try installing a colormap into a TrueColor
display, it doesn’t work, and usually gives an X error.

Yes, but couldn’t you apply these changes to every pixel? (of course, on
real hardware one could just change the gamma table… %sigh%)

njhOn Mon, 19 Oct 1998, Scott Stone wrote:

Cool. works quite well. Now if someone can just tell me how to read from the
palette for a surface, I can removes some ugly hacks and will be a very happy
guy.

/devOn 19-Oct-98 Sam Lantinga wrote:

The fast way I know to do this is:

  for entry in palette
  do entry.r += amount
     entry.g += amount
     entry.b += amount
  done

// David E. Vandewalle |Weinberg’s Law: If builders built
// vandewal at skyblue.com | buildings the way programmers wrote
// david.e.vandewalle at lmco.com | programs, then thefirst woodpecker that
// | came along would destroy civilization.

For RGB I would have thought that
for entry in palette
do entry.r *= 0.99
entry.g *= 0.99
entry.b *= 0.99
done
would like nicer?

Actually, to increase the gamma,

     for entry in palette
     do entry.r *= 1.1
        entry.g *= 1.1
        entry.b *= 1.1
     done

Would probably be better, although you’d have to watch for overflow.
(The same is true for my code:
for entry in palette
do for element in R G B
do value = (float)entry.element *= 1.1
if ( value > 255 )
entry.element = 255
else
entry.element = value
fi
done
done

Note that I have no idea of the real gamma correction algorithm.
This just makes colors arbitrarily brighter.

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Cool. works quite well. Now if someone can just tell me how to read from the
palette for a surface, I can removes some ugly hacks and will be a very happy
guy.

This is easy, just read the entries in surface->format->palette->colors[]

For example the RGB values of the 0’th element of the surface colormap is:
SDL_Palette *palette = surface->format->palette;

palette->colors[0].r;
palette->colors[0].g;
palette->colors[0].b;

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

For example the RGB values of the 0’th element of the surface colormap is:
SDL_Palette *palette = surface->format->palette;

palette->colors[0].r;
palette->colors[0].g;
palette->colors[0].b;

You need to check to make sure the surface has a palette (isn’t in Truecolor)
with the following code, or reading the palette will cause a segmentation fault
in your code:

if ( palette != NULL ) {
 	palette->colors[0].r;
 	palette->colors[0].g;
 	palette->colors[0].b;
}

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Actually, to increase the gamma,

     for entry in palette
     do entry.r *= 1.1
        entry.g *= 1.1
        entry.b *= 1.1
     done

[snip]

Note that I have no idea of the real gamma correction algorithm.
This just makes colors arbitrarily brighter.

“Real” gamma correction is like this, AFAIK (where ^ is used for
exponentation):

destColor = (origColor)^(1/gamma)

assuming your colors are floats 0.0-1.0. If they’re on the scale of 255,
then you have to scale them to 1.0 first:

destColor = ((origColor/255)^(1/gamma))*255

Just do this for each of red, green, and blue. This is better than
just multiplying the color because 0^x=0 and 1^x=1 (for any x), so you
don’t have to clamp the values. (Clamping looks ugly.)

-Chuck

“Real” gamma correction is like this, AFAIK (where ^ is used for
exponentation):

destColor = (origColor)^(1/gamma)

assuming your colors are floats 0.0-1.0. If they’re on the scale of 255,
then you have to scale them to 1.0 first:

destColor = ((origColor/255)^(1/gamma))*255

Just do this for each of red, green, and blue. This is better than
just multiplying the color because 0^x=0 and 1^x=1 (for any x), so you
don’t have to clamp the values. (Clamping looks ugly.)

I believe you should replace 1/gamma by gamma in the above. The value of
gamma is around 2 to 2.5 for most monitors. The equation you have given is
essentially what the monitor does, so you need to take the reciprocal to
undo it.

This is also assuming your images are linear to begin with; if not, you’d
probably do

destColor = ((origColor/255)^(new_gamma/old_gamma))*255

Ben.On Mon, 19 Oct 1998, Chuck Homic wrote:


 Benjamin Lewis                                 frogstar at earthling.net     

Congratulations! You have purchased an extremely fine device that would
give you thousands of years of trouble-free service, except that you
undoubtably will destroy it via some typical bonehead consumer maneuver.
Which is why we ask you to PLEASE FOR GOD’S SAKE READ THIS OWNER’S MANUAL
CAREFULLY BEFORE YOU UNPACK THE DEVICE. YOU ALREADY UNPACKED IT, DIDN’T
YOU? YOU UNPACKED IT AND PLUGGED IT IN AND TURNED IT ON AND FIDDLED WITH
THE KNOBS, AND NOW YOUR CHILD, THE SAME CHILD WHO ONCE SHOVED A POLISH
SAUSAGE INTO YOUR VIDEOCASSETTE RECORDER AND SET IT ON “FAST FORWARD”, THIS
CHILD ALSO IS FIDDLING WITH THE KNOBS, RIGHT? AND YOU’RE JUST NOW STARTING
TO READ THE INSTRUCTIONS, RIGHT??? WE MIGHT AS WELL JUST BREAK THESE
DEVICES RIGHT AT THE FACTORY BEFORE WE SHIP THEM OUT, YOU KNOW THAT?
– Dave Barry, “Read This First!”

I believe you should replace 1/gamma by gamma in the above. The value of
gamma is around 2 to 2.5 for most monitors. The equation you have given is
essentially what the monitor does, so you need to take the reciprocal to
undo it.

Nope. I ran both formulas through the infamous TI-85 and the 1/gamma formula
brightens the pixel, and the other one dims it. (Unless I don’t understand
something, which is quite possible on a monday.)

Congratulations! You have purchased an extremely fine device that would
give you thousands of years of trouble-free service, except that you
undoubtably will destroy it via some typical bonehead consumer maneuver.
Which is why we ask you to PLEASE FOR GOD’S SAKE READ THIS OWNER’S MANUAL
CAREFULLY BEFORE YOU UNPACK THE DEVICE. YOU ALREADY UNPACKED IT, DIDN’T
YOU? YOU UNPACKED IT AND PLUGGED IT IN AND TURNED IT ON AND FIDDLED WITH
THE KNOBS, AND NOW YOUR CHILD, THE SAME CHILD WHO ONCE SHOVED A POLISH
SAUSAGE INTO YOUR VIDEOCASSETTE RECORDER AND SET IT ON “FAST FORWARD”, THIS
CHILD ALSO IS FIDDLING WITH THE KNOBS, RIGHT? AND YOU’RE JUST NOW STARTING
TO READ THE INSTRUCTIONS, RIGHT??? WE MIGHT AS WELL JUST BREAK THESE
DEVICES RIGHT AT THE FACTORY BEFORE WE SHIP THEM OUT, YOU KNOW THAT?
– Dave Barry, “Read This First!”

^^ This is really, really cool!

/devOn 19-Oct-98 Benjamin Lewis wrote:


// David E. Vandewalle |Weinberg’s Law: If builders built
// vandewal at skyblue.com | buildings the way programmers wrote
// david.e.vandewalle at lmco.com | programs, then thefirst woodpecker that
// | came along would destroy civilization.

I believe you should replace 1/gamma by gamma in the above. The value of
gamma is around 2 to 2.5 for most monitors. The equation you have given is
essentially what the monitor does, so you need to take the reciprocal to
undo it.

Nope. I ran both formulas through the infamous TI-85 and the 1/gamma formula
brightens the pixel, and the other one dims it. (Unless I don’t understand
something, which is quite possible on a monday.)

Nope, you understand just fine. I stand corrected, which is pretty
embarrassing considering I’m currently doing research in monitor
calibration :slight_smile: (mental note to self to stop posting on 3 hours sleep…)

Ben.On Mon, 19 Oct 1998, David Vandewalle wrote:

On 19-Oct-98 Benjamin Lewis wrote:


Benjamin Lewis frogstar at earthling.net

Although the moon is smaller than the earth, it is farther away.

This is also assuming your images are linear to begin with; if not, you’d
probably do

destColor = ((origColor/255)^(new_gamma/old_gamma))*255

Of course, the real question is what do you want to do?

njhOn Mon, 19 Oct 1998, Benjamin Lewis wrote: