SDL_GL_SwapBuffers() appears slow

Hi,

I have an SDL/OpenGL app that I am working on. On my P4 HT 2,53 MHz box
witha GForce 4 MX 440, I get about 60 FPS in windowed and fullscreen mode.

When I remove the SDL_GL_SwapBuffers(), I get 1000 FPS. Why is
SDL_GL_SwapBuffers() slowing things down that much?

Thanks,

Gerald

My best guess would be that SDL_GL_SwapBuffers is matched your monitor’s
vertical sync, which is probably set at 60Hz, thereby limiting it to 60
FPS. Try upping the sync to 75Hz and I’m pretty sure you’ll find it
magically increases to 75 FPS :slight_smile: There are various ways to turn vsync
off, depending on your hardware, Google is your friend.On Thu, 2004-02-19 at 21:28, Gerald wrote:

I have an SDL/OpenGL app that I am working on. On my P4 HT 2,53 MHz box
witha GForce 4 MX 440, I get about 60 FPS in windowed and fullscreen mode.

When I remove the SDL_GL_SwapBuffers(), I get 1000 FPS. Why is
SDL_GL_SwapBuffers() slowing things down that much?


http://www.mattsscripts.co.uk/

  • A great source for free CGI and stuff

‘And I promise you this,’ he [Carrot] shouted, ‘if we succeed, no-one
will remember. And if we fail, no one will forget!’
(Jingo)

Ppl,

I asked three days ago 'bout a SDL/GTK/OpenGL Example Sam sent to the
list sometime ago. Does anyone has it yet? Noone answered…I f some1
can help…or has another example. All I need is to put a SDL Window
attached or inside a GTK one. I could only get two separated windos.
I REALLY need it.

Thanks,
Bruce Sinner

A quick search on Google and I found this:

http://www.libsdl.org/pipermail/sdl/2001-December/040793.htmlOn Monday 23 February 2004 1:16 pm, Bruce Barrera wrote:

Ppl,

I asked three days ago 'bout a SDL/GTK/OpenGL Example Sam sent to the
list sometime ago. Does anyone has it yet? Noone answered…I f some1
can help…or has another example. All I need is to put a SDL Window
attached or inside a GTK one. I could only get two separated windos.
I REALLY need it.

Thanks,
Bruce Sinner


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

Matt Wilson wrote:>On Thu, 2004-02-19 at 21:28, Gerald wrote:

When I remove the SDL_GL_SwapBuffers(), I get 1000 FPS. Why is
SDL_GL_SwapBuffers() slowing things down that much?

There are various ways to turn vsync
off, depending on your hardware, Google is your friend.

However, you shouldn’t turn vsync off, except for testing purposes. Your
monitor won’t display more frames without vsync, but it can cause tearing.
This has also been discussed in the recent past.

Sebastian

Sebastian Beschke wrote:

Matt Wilson wrote:

When I remove the SDL_GL_SwapBuffers(), I get 1000 FPS. Why is
SDL_GL_SwapBuffers() slowing things down that much?

that’s right, because nothing rasterized to screen.

Some games use not sync every frame, do not do what swap_buffers do.
I used to do not call swap_buffers every game cycle… but, it can cause
tearing, depending on your monitor…>> On Thu, 2004-02-19 at 21:28, Gerald wrote:

could someone define tearing for me?

thanks

~jacob

Bira wrote:> Sebastian Beschke wrote:

Matt Wilson wrote:

On Thu, 2004-02-19 at 21:28, Gerald wrote:

When I remove the SDL_GL_SwapBuffers(), I get 1000 FPS. Why is
SDL_GL_SwapBuffers() slowing things down that much?

that’s right, because nothing rasterized to screen.

Some games use not sync every frame, do not do what swap_buffers do. I
used to do not call swap_buffers every game cycle… but, it can cause
tearing, depending on your monitor…


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

Horizontal tears in the image occuring at random positions, caused by
the display buffer being modified at the same time as the display is
being refreshed.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 25 February 2004 21.11, Jacob Lambert wrote:

could someone define tearing for me?

thanks

David Olofson wrote:> On Wednesday 25 February 2004 21.11, Jacob Lambert wrote:

could someone define tearing for me?

Horizontal tears in the image occuring at random positions, caused by
the display buffer being modified at the same time as the display is
being refreshed.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se


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

Jacob Lambert wrote:

could someone define tearing for me?

tearing -> tears from your eyes (sorry the joke, but in portuguese it
could be read like this ) :slight_smile:
may be the best definition is, the efect, impression caused by image
flickering.

I think :slight_smile: