Refresh rate

I can get 85hz in Quake 3 1.32 on Windows 2000 with my GeForce 4
ti4200. I had to run the nvidia refresh utility, which allowed for
higher refresh rates. After doing so, I changed r_displayrefresh to
85 and did a vid_restart.

Quake 3 does not use SDL internally, but this shows that it IS
possible.

I believe that the onus falls on SDL to implement varied refresh
rates.

The first parameter to ChangeDisplaySettings() is a DEVMODE struct,
which has a value dmDisplayFrequency which should be set to the hz
value of your refresh rate. You also need to pass the flag
DM_DISPLAYFREQUENCY to the dmDisplayFlags.

This is all windows GDI programming. Perhaps a proposed interface
change and subsequent patch with consideration for SDL_SetVideoMode()
is in order?

Alan Wolfe writes:> Im not much more help, but try asking around or googling for how to

disable vsync from within your game.

or…ask around on irc…particularly on undernet in #OpenGL, i
heard rumors of a guy who goes by Squall that knows how to do that
so other people around there must know as well.


Michael L. Labbe
http://www.threewavesoftware.com
(604)552-9283 8:00am-6:00pm PST

Jason Clark wrote:

Before I go running off re-inventing the wheel (my version would undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.

This can be done in less than 10 lines of code. Just write two nested
for loops to copy the pixels to the right place on destination :wink:

  1. Copy one SDL_Surface to another.

This is even easier, one liner.

  1. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.

Hm, don’t know about this one… what exactly do you want to do?–
Milan Babuskov
http://njam.sourceforge.net

Thanks Milan,
1 & 2) I know that I can manually do it, I just wanted to make sure the
functionality didn’t already exist in some form I wasn’t aware of (I’m
trying to avoid duplicating effort).
3) This I can manually do if I have to but am hoping there is some already
supported functionality. I’ll give an example of what I need to do
I have a 32x32 pixel image with a filled circle in it. The circle is
surrounded by a color that I want to have completely transparent. The circle
itself I want to Alpha blend at say 25%. I know I can do either of these
with SDL, however doing both to the same image is eluding me. If I have to
I’ll write a routine that takes the image and manually adjusts the
individual pixels of the circle and use SDL to give the transparency around
it, but chances are I’m liable to be fairly inefficient at it.

Thanks again,
Jason.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Milan Babuskov
Sent: Wednesday, October 01, 2003 12:17 AM
To: sdl at libsdl.org
Subject: Re: [SDL] A couple of questions…

Jason Clark wrote:

Before I go running off re-inventing the wheel (my version would
undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.

This can be done in less than 10 lines of code. Just write two nested
for loops to copy the pixels to the right place on destination :wink:

  1. Copy one SDL_Surface to another.

This is even easier, one liner.

  1. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.

Hm, don’t know about this one… what exactly do you want to do?


Milan Babuskov
http://njam.sourceforge.net


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

Jason,
What you’re talking about with regard to the outside perimiter of the circle is transparency. To accomplish this, simply load the bitmap into it’s own surface (using SDL_LoadBMP() for example), then call:

int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);

for example:

SDL_SetColorKey(lpMyBitmapSurface, SDL_SRCCOLORKEY, 0x00000000);

In the example above, the color is 0x00000000, or all black. Now, all bits in your bitmap surface that are black will be transparent when you blit it onto another surface. Make use of RGB macros to set the transparency color you wish to use.

You can then set the alpha blending property of a surface using:
int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);

See the SDL docs for all the different flags you can use for the above two functions.

Hope this helps!

Jason Clark wrote:
Thanks Milan,
1 & 2) I know that I can manually do it, I just wanted to make sure the
functionality didn’t already exist in some form I wasn’t aware of (I’m
trying to avoid duplicating effort).
3) This I can manually do if I have to but am hoping there is some already
supported functionality. I’ll give an example of what I need to do
I have a 32x32 pixel image with a filled circle in it. The circle is
surrounded by a color that I want to have completely transparent. The circle
itself I want to Alpha blend at say 25%. I know I can do either of these
with SDL, however doing both to the same image is eluding me. If I have to
I’ll write a routine that takes the image and manually adjusts the
individual pixels of the circle and use SDL to give the transparency around
it, but chances are I’m liable to be fairly inefficient at it.

Thanks again,
Jason.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Milan Babuskov
Sent: Wednesday, October 01, 2003 12:17 AM
To: sdl at libsdl.org
Subject: Re: [SDL] A couple of questions…

Jason Clark wrote:

Before I go running off re-inventing the wheel (my version would
undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.

This can be done in less than 10 lines of code. Just write two nested
for loops to copy the pixels to the right place on destination :wink:

  1. Copy one SDL_Surface to another.

This is even easier, one liner.

  1. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.

Hm, don’t know about this one… what exactly do you want to do?


Milan Babuskov
http://njam.sourceforge.net


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


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


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

  1. Copy one SDL_Surface to another.

Look at SDL_BlitSurface, it does what you want.

Julien> ----- Original Message -----

From: jclark@ccpu.com (Jason Clark)
To:
Sent: Wednesday, October 01, 2003 2:01 AM
Subject: [SDL] A couple of questions…

Before I go running off re-inventing the wheel (my version would
undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.
  2. Copy one SDL_Surface to another.
  3. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.

I can go about these using brute force techniques but wanted to see if
anyone out there had a more graceful solution.
Thanks,
Jason


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

Before I go running off re-inventing the wheel (my version would
undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

Hey, square wheels would be kinda cool… bit bumpy though

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.
    Check out SDL_LoadBMP()
  1. Copy one SDL_Surface to another.
    SDL_BlitSurface, as some other pointed out.
  1. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.
    Use Gimp or Photoshop to set up transparency, not hard but some fiddeling may
    be necesarry. Then save the file as a .TGA(has always been a nice format in my
    opinion) with alpha chanel. Then download SDL_Image from libsdl.org, its a
    library that can load .TGA files to a surface with alpha information intact…
    then just blit it.

I can go about these using brute force techniques but wanted to see if
anyone out there had a more graceful solution.

Brute force is always kinda cool…

Cya and good luck.

Thanks Julien!
Seems my brain must have gone on hiatus.
Let’s hear it for the obvious!
Jason> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Julien Pauty
Sent: Thursday, October 02, 2003 4:06 AM
To: sdl at libsdl.org
Subject: Re: [SDL] A couple of questions…

  1. Copy one SDL_Surface to another.

Look at SDL_BlitSurface, it does what you want.

Julien
----- Original Message -----
From: @Jason_Clark (Jason Clark)
To:
Sent: Wednesday, October 01, 2003 2:01 AM
Subject: [SDL] A couple of questions…

Before I go running off re-inventing the wheel (my version would
undoubtedly
look remarkably like a square), I wanted to see if any of you have already
developed solutions for them:

  1. I need to be able to read a source Rect from a bmp and rotate it 90
    degrees.
  2. Copy one SDL_Surface to another.
  3. take a Rect and apply different levels of alpha, i.e., make one color
    fully transparent and then apply a % to the remainder of the image.

I can go about these using brute force techniques but wanted to see if
anyone out there had a more graceful solution.
Thanks,
Jason


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


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

I knew I wouldn’t have been the first to want SDL_Rect transforms. I just
found this on the web for anyone else interested.
http://home.swipnet.se/cal_home/sge/

Jason.