Webgl Context Is Redrawn Completely For No Apparent Reason
I'm experimenting with WebGL and it seems to me that I've missing something very basic but still can not find in docs and examples what exactly. So imagine I want to draw a rectang
Solution 1:
There is a a second argument - some optional parameters - for the getCcontext()
method.
In Your example, try adding following lines of code:
var canvas = document.getElementById("c");
varNO_ANTIALIAS=false,
CLEAR_DRAWING_BUFFER=false,
attributes = {antialias: !NO_ANTIALIAS, preserveDrawingBuffer: !CLEAR_DRAWING_BUFFER};
var gl = canvas.getContext("webgl", attributes);
Explanation:
- antialias: this is just a hint for the browser - when available, try to smooth drawing borders
- preserveDrawingBuffer: You need to take care of clearing the drawing buffer by Your self
Here is the reference: WebGL Specification - Context creation
Post a Comment for "Webgl Context Is Redrawn Completely For No Apparent Reason"