Qbasicnews.com

Full Version: Ghosts in SDL fullscreen?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My compo entry in the qbxl contest looks fine at first, but it has one crtical flaw: in fullscreen modes, it has wierd "ghosting" problems, almost like flip doesn't actually use the pages corectly.

Does anyone have any idea why this might happen? Any ideas on how I can fix it?
Plain SDL, or FB's built in graphics library?

If plain SDL, did you use SDL_DOUBLEBUF with SDL_SetVideoMode?
You need to clear the pages.

SDL_Fillrect

It's fun to watch though, makes me go insane after a while.. but meh, fun fun =)
The first thing I do every frame is:

rect.x = 0
rect.y = 0
rect.w = screenSurface->w
rect.h = screenSurface->h
SDL_FillRect screenSurface, rect, black

afterwards I start drawing the screen.


The ghosting happens with the following options:

xres
800
yres
600
depth
32
sdl_hwsurface
sdl_doublebuf
sdl_hwaccel
sdl_fullscreen

Fullscreen is the one that gets it though.

When I flip pages I...

SDL_Flip screenSurface
SDL_PumpEvents

every frame, too.

there doesn't seem to be a problem windowed, just fullscreen. That's a pity, because this game was born to be played on a TV screen with a couple of gamepads, imho.
Nevermind, I found the problem. I was pageflipping every cycle, but only rendering every once in a while(I introduced a timer based loop to keep the game at 60fps on these monster PCs at school). This worked fine in windowed modes because they just kept on showing the same page over and over, but in hardware double buffered modes, it was actually two sections of video memory.

I feel stupid, but it's better than not finding the bug. As an added bonus, I found SDL_Delay, which lets you tell the OS to do something else for a while. It was very interesting seeing this game at 320x240 -- 0% cpu utilization. Beat THAT, qb! ^ ^