Sets whether the frame buffer should be cleared when Sync or Swap are called. By default this is set to true. The only reason to call this command is if you have a background sprite, or set of sprites, that completely cover the screen so the background color will never be visible. In these cases some GPUs can benefit from turning the clear color off. Please note that in many cases the last drawn frame will remain on screen, however, this is not guaranteed, and you should not create effects that rely on it as they may not work in future, and won't work on mobile devices. To create effects that maintain the contents of the previous frame it is recommended that you use SetRenderToImage to capture the output of one frame and then draw it into the next frame, i.e. you render everything to image 1, then in the next frame you paste image 1 into the background of a new render target and then draw the new frame. For example draw everything in frame 1 to image 1, then in frame 2 you draw image 1 with a full screen Quad object to image 2, and then draw everything in frame 2 to image 2. You can then swap the render targets so in frame 3 you draw image 2 with a full screen quad back into image 1, then draw the objects in frame 3 to image 1. Continue to alternate between image 1 and 2, so frame 4 would first have image 1 drawn with a full screen quad to image 2, then draw everything in frame 4 to image 2. It is important to not continue drawing everything to the same image, i.e. draw frame 1 to image 1, then frame 2 to image 1, and so on because mobile devices use an internal deferred renderer that will keep an ever increasing list of things to draw to image 1. If the image is never cleared then performance will degrade.


EnableClearColor( clear )