move drawing to top of render loop

This commit is contained in:
Magnus Ulimoen 2019-12-11 19:32:03 +01:00
parent 7430e8793e
commit 07e08c6236
1 changed files with 3 additions and 2 deletions

View File

@ -224,8 +224,6 @@ import { Universe, default as init, set_panic_hook as setPanicHook } from "./max
dt = MAX_DT;
}
}
universe.advance(dt/2);
universe.advance(dt/2);
let fieldPtr;
if (chosenField.value === 0) {
@ -245,6 +243,9 @@ import { Universe, default as init, set_panic_hook as setPanicHook } from "./max
gl.drawElements(gl.TRIANGLES, vertexCount, type, offset);
}
universe.advance(dt/2);
universe.advance(dt/2);
window.requestAnimationFrame(drawMe);
}