3.5 Offscreen rendering

If you pass True to the sdl.EnableOffscreenRender() command, all hardware brushes that are created after the call to sdl.EnableOffscreenRender() can be drawn to using Hollywood's SelectBrush() command. These drawing operations can also be hardware-accelerated which gives them an advantage over Hollywood's default offscreen drawing routines which can only draw to software brushes.

There is, however, a major limitation that you have to keep in mind: Hardware brushes which can be drawn to using SelectBrush() will lose their contents on Windows whenever the window size is changed or when the window's display mode changes, e.g. from full screen mode to window or the other way round. Thus, using hardware brushes which can be drawn to really only makes sense if you update them every frame or if you are able to re-initialize them whenever the window's size or display mode changes. If your script isn't able to handle that, you will be in trouble. Because of this limitation, it is also highly advised to call sdl.EnableOffscreenRender() with its argument set to False immediately after you have created the hardware brushes that you want to use for offscreen drawing. Otherwise, all hardware brushes created subsequently will also be prepared for offscreen drawing and will thus suffer from the limitations described above.

Note that in order to utilize hardware acceleration on offscreen drawing you need to follow the same rules as when drawing to a hardware double buffer. Only a few graphics operations are hardware-accelerated. See Drawing graphics for details.

It is also important to note that the different combo modes supported by SelectBrush() won't work with RebelSDL. Instead, graphics are always drawn to the color and the alpha channel of the hardware brush, no matter which mode you specify. Also, you cannot use SelectMask() or SelectAlphaChannel() with hardware brushes. It's only possible to use SelectBrush() to draw into color and alpha channels at the same time.


Show TOC