WebGL: Prevent color buffer from being cleared in HTML5

JavascriptObject Oriented ProgrammingFront End Technology

Even if removing the color by code:

mycanvas.clear(can.COLOR_BUFFER_BIT );

The screen gets cleared at beginning of next draw cycle.

To create WebGLRenderingContext, previous drawing buffer can be preserved.

gl = someCanvas.getContext("webgl", { preserveDrawingBuffer: true });

 The default is preserveDrawingBuffer: false by making this property true, previous drawing can be easily preserved

Updated on 30-Jan-2020 06:53:31