When using a basic animate function like this:
function animate() {
geometry.elementsNeedUpdate = true;
requestAnimationFrame( animate );
renderer.render( scene, camera ); }
A memory allocation occurs even if no elements are changed. To address this, I decided to manipulate the color of the face as well.
function animate() {
geometry.elementsNeedUpdate = true;
time = clock.getElapsedTime();
if ( time * 16 % 10 < 5 ) {
geometry.faces[ 0 ].color = colorBlue;
} else {
geometry.faces[ 0 ].color = colorRed;
}
requestAnimationFrame( animate );
renderer.render( scene, camera ); }
This manipulativeness still results in memory allocation. However, setting
geometry.elementsNeedUpdate = true;
is crucial for changing face colors.
Is there a way to prevent this memory allocation?
You can find the complete example on