[SDL] Re: direct access to video memory

Randi J. Relander rjrelander at users.sourceforge.net
Wed Jan 24 06:30:10 PST 2001


Alexander Chemeris wrote:
>
> Gautier Portet wrote:
> >
> > if you call SDL_SetVideoMode with SDL_FULLSCREEN only
> > (NOT SDL_DOUBLEBUF) you DO have direct video memory
> > access (at least under win/dx)
>
> This is extraction from my code:
>
> SDL_SetVideoMode(800,600,16,SDL_FULLSCREEN);
> ...
> SDL_Surface *video;
> ...
> video = SDL_GetVideoSurface();
> ...
> SDL_BlitSurface(Cursor[CurentCursor],NULL,video,vRect);
>
> So, cursor DIDN'T show on the screen.
> But, after adding
>
> SDL_UpdateRects(video,2,tRect);
>
> it did.

Shouldn't that be SDL_FULLSCREEN|SDL_HWSURFACE for direct access? Just using
SDL_FULLSCREEN implies SDL_SWSURFACE and causes a shadow surface to be
created. Blits go to the shadow and then update transfers shadow to screen.
BTW, this is non-portable since direct access to the screen is not available
on some (many?) platforms.

- Randi

Regimental Command
Generic Armored Combat System
http://regcom.sourceforge.net











More information about the SDL mailing list