move drawing to top of render loop
This commit is contained in:
parent
7430e8793e
commit
07e08c6236
5
main.js
5
main.js
|
@ -224,8 +224,6 @@ import { Universe, default as init, set_panic_hook as setPanicHook } from "./max
|
||||||
dt = MAX_DT;
|
dt = MAX_DT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
universe.advance(dt/2);
|
|
||||||
universe.advance(dt/2);
|
|
||||||
|
|
||||||
let fieldPtr;
|
let fieldPtr;
|
||||||
if (chosenField.value === 0) {
|
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);
|
gl.drawElements(gl.TRIANGLES, vertexCount, type, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
universe.advance(dt/2);
|
||||||
|
universe.advance(dt/2);
|
||||||
|
|
||||||
window.requestAnimationFrame(drawMe);
|
window.requestAnimationFrame(drawMe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue