In a message dated 1/1/02 12:03:09 PM Pacific Standard Time,
sdl-request at libsdl.org writes:
You may have run out of memory on your video card and are blitting from
system memory to video card memory. But for 1 fps it sounds like you are
reading graphic data from your video card. Perhaps you have alpha blending
switched on and one of the surfaces is in system memory and one is in video
card memory.
No, i have tons of video memory and I’m sure all the video settings are
correct…here is my code…
void Init_SDL()
{
/* Initialize the SDL library */
if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
“Could not initialize SDL: %s\n”, SDL_GetError());
exit(1);
}
atexit(SDL_Quit); //Cleanup on exit
screen = SDL_SetVideoMode(800, 600, 24, SDL_HWSURFACE || SDL_DOUBLEBUF);
//set screen to 800x600x24
if ( screen == NULL ) {
fprintf(stderr, “Could not set 800x600x24 video mode: %s\n”,
SDL_GetError());
exit(1);
}
temp = SDL_CreateRGBSurface(SDL_SWSURFACE, 800, 600, 24,
NULL, NULL, NULL, NULL);
}
I have tried just blit-ing to the screen and I have tried blit-ing to temp
and then when I’m done blit temp to the screen…but nothing works. I’ve
read some other messages about such slowness and they suggest blit-ing the
part of the screen that doesn’t need redrawing back onto the screen in it’s
new location…so if I were to move left 20 pixels it would be
SDL_BlitSurface(screen, &srect, temp, &drect); where srect is X = 0 Y = 0
W = 800 - 20 H = 600 drect is X = 20 Y = 0 and then
draw the left side of the screen onto temp and blit temp to the
screen…not a bad idea, and it would help too, but I should have to do
that. I can redraw the whole screen with triple buffering on a 800x600x8
screen in QB at more than 24fps…so why can’t I do it in C?