Hello hey, I have this situation/question,
I’m locking a surface and then working on it much in the following way (I
included the basic calls I’m making for differnt systems). The question is:
once I’ve modified the surface (via pixels), and unlocked,
flipped/swapped/displayed to the screen, the next time I get the pointer
pixels to the surface, will the surface still contain the modifications I
did the last time (before the flip/display)?
I have tried doing it and it seems the things I “painted” are still there
the next time, but I want to know if this behavior is expected and
guaranteed, or if it’s just a coincidence. And if it’s expected on some but
not on other systems I’m using (opengl, ddraw, etc.) please let me know on
which ones that behavior is guaranteed.
The calls I’m using:
SDL_Block sdl;
SCREEN_SURFACE:
SDL_LockSurface(sdl.surface)
pixels=(Bit8u *)sdl.surface->pixels;
work with pixels
SDL_UnlockSurface(sdl.surface);
SDL_Flip(sdl.surface);
SCREEN_SURFACE_DDRAW:
SDL_LockSurface(sdl.blit.surface)
pixels=(Bit8u *)sdl.blit.surface->pixels;
work with pixels
SDL_UnlockSurface(sdl.blit.surface);
IDirectDrawSurface3_Blt(
sdl.surface->hwdata->dd_writebuf,&sdl.blit.rect,
sdl.blit.surface->hwdata->dd_surface,0,
DDBLT_WAIT, NULL);
SCREEN_OVERLAY:
SDL_LockYUVOverlay(sdl.overlay);
pixels=(Bit8u )(sdl.overlay->pixels);
work with pixels
SDL_UnlockYUVOverlay(sdl.overlay);
SDL_DisplayYUVOverlay(sdl.overlay,&sdl.clip);
SCREEN_OPENGL:
pixels=(Bit8u *)sdl.opengl.framebuf;
work with pixels
glBindTexture(GL_TEXTURE_2D, sdl.opengl.texture);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
sdl.draw.width, sdl.draw.height, GL_BGRA_EXT,
GL_UNSIGNED_INT_8_8_8_8_REV, sdl.opengl.framebuf);
SDL_GL_SwapBuffers();
Thanks.
Kronuz.
“Fools rush in where fools have been before” - Unknown