Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

WebGL: Prevent color buffer from being cleared in HTML5

How can I prevent the color buffer from being cleared in HTML5?


1 Answer
Samual Sam

Even if removing the color by code:

mycanvas.clearColor(d[1],d[2],d[3],2.0);
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

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.