[SDL] problem with SDL_SwapBuffers()

Davide "M3xican" Coppola dmc at dev-labs.net
Wed Jun 28 01:57:14 PDT 2006


Yaser Zhian Tabasy wrote:
> I am by no means an expert in these matters, so I may be entirely wrong.
>
> One possible cause of this problem may be that your SwapBuffers()
> waits for the screen refresh (V-Sync) to actually do the swap or
> copy or whatever. Whether your application actually does this or not
> depends on the flags you pass when setting video mode
> (double-buffered or not, hardware buffer or not, full-screen or not)
> and also on your graphics card driver's configuration (easily
> modifiable on Windows/nVidia, don't know about others.)
>
> In order to check whether this is happening or not, measure your
> code's frame rate. If it matches the refresh rate of your desktop,
> then it's almost definitely the V-Sync. To make extra sure, remove a
> lot of drawing code (or add a lot, if you're testing with empty
> drawing code) and measure the frame rate again. If it doesn't change
> much, then you're extra sure.
>
> -yzt
>   
I have done some tests, now I think that vsync is not the problem,
cause FPS doesn't match with it, but I have discovered that removing
half of blits (moving from 200 to 100 128x64 tiles) the time needed to
swap the buffers is less than half (~5 ms.) in both resolutions.

Any suggestion to solve this?
At the moment the flag I pass to SDL_SetVideoMode() is just SDL_OPENGL.

You can find the source in this SVN repository:
http://svn.sourceforge.net/viewcvs.cgi/mars/mars/trunk/src/graphic/
related files are:
GLScreen.h/.cpp
GLSurface.h/.cpp
GLImage.h/.cpp

Thanx

-- 

Davide "M3xican" Coppola

--------------------------------------------------------------------
email:  dmc at dev-labs.net
homep:  http://dmc.dev-labs.net
ICQ:    104241710
MSN:	bad_hangover at hotmail.it

Don't use IE and OE! 
Download FireFox and ThunderBird: http://www.mozilla.org/
--------------------------------------------------------------------





More information about the SDL mailing list