paeryn
Reclusive maniac
Don't Lock the screen!!! Only do that if you're going to read/write directly to the bitmap. SDL_LockSurface() tells SDL that you're manipulating the bitmap yourself and it isn't to.miq01 posted on Feb 9 2006 at 04:22 AM said:Hi Paeryn. First of all, thanks a lot for your work!
And now, my small problem. I've recompiled my program using your HW accelerated version of SDL, and if I keep the SDL_SWSURFACE flag in SDL_SetVideoMode everything works fine. But if I use SDL_HWSURFACE|SDL_DOUBLEBUF, bitmaps are not shown on screen. On the other hand, it shows two rectangles drawn using SDL_FillRect. I've read the posts about double buffering and SDL_Flip, and I think my problem is related to it, but I still don't know how to solve it.
The sequence of calls I use to draw every frame is:
Code:if (SDL_MUSTLOCK(screen)) if (SDL_LockSurface(screen) < 0) return; // Clear the screen SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); <here I draw bitmaps using SDL_BlitSurface and two small rectangles using SDL_FillRect> if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); SDL_Flip(screen);
As I said before, the rectangles are shown, but not the bitmaps. Any idea of what am I doing wrong?
FillRect doesn't seem to check, but SDL_BlitSurface should be returning an error, you are checking it's return value aren't you?
From start of SDL_BlitSurface:
Code:
if ( src->locked || dst->locked ) {
SDL_SetError("Surfaces must not be locked during blit");
return(-1);
}
Last edited by a moderator: