Clear Canvas WebGL, Three.JS

I am working with WebGLRenderer in three.js file and I cannot clear the canvas. Basically, I have a method that adds another object to the scene, but clears up the children before adding them. For example,

group = new THREE.Object3D();

function add(object){
    group.children = [];//clears the group children first
    group.add(object);
}

      

I thought it would make it clear, but I was wrong. I'm used to canvasrendering doing this for me. Does anyone know how I need to clear the WebGL canvas?

+3


source to share





All Articles