3.3 Drawing graphics

For an optimal performance you need to be very careful concerning the way you draw your graphics. Most of Hollywood's drawing commands are implemented in software only, i.e. they draw using the CPU instead of the GPU. This can become quite a bottleneck especially on slower CPUs. Thus, you should know which drawing functions are hardware-accelerated and which aren't and then write your scripts accordingly.

The following Hollywood commands are hardware-accelerated when RebelSDL is active and they are used within a hardware double buffer:

 
Box()
Cls()
Line()
Plot()
DisplayBrush()

DisplayBrush() will only use hardware acceleration when called with a hardware brush. See Using hardware brushes for details. When used with a software brush, i.e. a brush that doesn't reside in video memory, DisplayBrush() will draw the brush using the CPU which is much slower.

Box(), Line(), and WritePixel() will only use hardware acceleration in case the fill style is either #FILLNONE or #FILLCOLOR and no other form styles like #EDGE or #SHADOW are active. As soon as you want to draw with other fill or form styles, these commands will fall back to their software counterparts and thus will be very slow. You can work around this problem by simply drawing the graphics into a hardware brush first and then just drawing this hardware brush. This is a good strategy because then Hollywood's software renderer will be used only once, i.e. when drawing the graphics into a hardware brush, and after that you'll profit from hardware acceleration all the time because hardware brushes can be drawn really quickly.

Finally, don't forget that you should do all your drawing inside a hardware double buffer loop. See Using a hardware double buffer for details.


Show TOC