[SDL] Double buffering waitretrace and flickering

dtabuenc at cs.ucr.edu dtabuenc at cs.ucr.edu
Wed Aug 18 21:52:35 PDT 1999


Ok here is the code I promissed. It's pretty straight forward so I am
either making a really silly mistake or something is not right.
Basically I even took away the image blit and I am just filling a
rectangle now. It runs fine in windowed mode (single buffered) when
doing it in DGA mode under root horrible flicker! Anyone know where
this flicker is comming from?

#include <SDL/SDL.h>
#include <iostream.h>
#include <stdlib.h>
int main()
{
SDL_Surface *screen;
SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);
screen=SDL_SetVideoMode(640,480,16,SDL_FULLSCREEN|SDL_DOUBLEBUF);
if(screen->flags&&SDL_DOUBLEBUF)
        cout << "Using Double Buffering\n";
else
        cout << "Using a single buffer\n";
static Uint32 black=SDL_MapRGB(screen->format,0,0,0);
static Uint32 blue= SDL_MapRGB(screen->format,0,0,255);;
 SDL_Rect dstrect;
dstrect.x = (640/2-16);
dstrect.y = (480-64);
dstrect.w = 64;
dstrect.h = 64;
SDL_Event event;
while(true)
        {
        SDL_FillRect(screen, 0,black);//Clear whole buffer
        SDL_FillRect(screen,&dstrect, blue); //Fill in little blue rect on bottom
        SDL_Flip(screen);
        SDL_PollEvent(&event);
        if(event.type == SDL_KEYDOWN)
                exit(0);
        }
}






More information about the SDL mailing list