render method
Renders the scene
scenethe scene to render.camerathe scene camera.
Implementation
void render(Scene scene, Camera camera) {
// Tell WebGL how to convert from clip space to pixels
gl.viewport(0, 0, (width * dpr).toInt() + 1, (height * dpr).toInt());
// Clear the canvas. sets the canvas background color.
// gl.clearColor(0, 0, 0, 1);
gl.clearColor(_backgroundColor[0], _backgroundColor[1], _backgroundColor[2], _backgroundColor[3]);
// Clear the canvas AND the depth buffer.
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// enable CULL_FACE and DEPTH_TEST.
gl.enable(gl.CULL_FACE);
gl.enable(gl.DEPTH_TEST);
// draw the objects.
drawObjects(scene, camera);
// ! super important.
// ! never put this inside a loop because it takes some time
// ! to update the texture.
gl.finish();
flgl.updateTexture();
}