basically what if freaking me out is the whole no more screen to plot to, i
create a window, then set that as rendering target… then dunno, is the
generl idea to have a texture for the window use that as you would the
screen surface, then put that in the window when plotting is over?
The idea is to better reflect what happens with modern hardware, where
the window content is either completely inaccessible (like it’s always
been on X11, and SDL just faked it), or generally difficult/expensive
to access (might be encoded in a certain way, or small read/writes
over the bus just suck and require hardware accelerator flushes, etc),
not to mention that it’s always been kind of unsafe even when you
could do it, in a windowed environment.
So what you get is more representative of what the hardware likes to
do. You get textures that you can blit to windows, a few other drawing
operations, and that’s it. After that, if you liked the old way, you
can do what SDL 1.2 did (and what the compatibility layer does), and
fake it, by creating a single streamable texture the size of the
window, lock it, draw to it, then unlock it and blit the whole thing
to the screen (like SDL_Flip did) or just the parts that you changed
(like SDL_UpdateRect). You’ll get similar performance to SDL 1.2,
which might be the best possible on the platform anyway (if you’re on
something like X11), or much slower than what would be possible (the
OpenGL backend can do much better if used “properly”, I think?).
Just consider what you’re doing when you “plot to the screen”: do you
refresh the dirty parts of the background, then put the new characters
in their updated position, for example? Put the background and the
characters art in textures (they could be static, if you’re not
updating them, which allows for more possibilities for acceleration),
then use a bunch of SDL_RenderCopy and SDL_RenderFill to do the
plotting (there’s other functions, but these three are the “most
likely to be fast ones”).On Fri, May 8, 2009 at 4:59 AM, Neil White wrote:
–
http://pphaneuf.livejournal.com/