I am currently working on a project using the WebGLRenderer in three.js, but I am facing an issue with clearing the canvas. The problem arises when I try to add another object to the scene by first clearing out the children of a group. Here is the code snippet:
group = new THREE.Object3D();
function add(object){
group.children = [];//clears the group children first
group.add(object);
}
Despite attempting to clear the children of the group, the canvas does not clear as expected. In traditional canvas rendering, this process is usually handled automatically. Can anyone provide insights into how I can properly clear the WebGL canvas?