Actual fix for the blank-on-save problem.
Actual fix for the blank-on-save problem.

The previous commit actually seemed to make the problem worse - images were always blank.
Upon further investigation, it appears by default the browser blanks the context's buffer after you're done drawing with it. It appears to use this same buffer when you attempt to save the image on the canvas, which explains why the image was sometimes showing up blank.

Apparantly, the only reason images were savable at all before the previous commit was because it was being drawn every frame, and therefore an image was more frequently available on the buffer (there appears to be a slight delay between being finishing a set of drawing operations and the buffer being automatically cleared).

Luckily, this feature can be disabled during context creation by setting the preserveDrawingBuffer attribute to true when calling canvas.getContext() and seems to have fixed the problem for good this time.

theJ8910/WebGLBox,theJ8910/WebGLBox