-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangles.ts
More file actions
42 lines (33 loc) · 1.07 KB
/
Copy pathTriangles.ts
File metadata and controls
42 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Graphics } from "./glPort/Graphics";
import { Shader } from "./glPort/Shader";
import { loadScene, drawScene} from "./DisplayScene";
//import { loadScene, drawScene, mouseClick, mouseMove } from "./InteractiveScene";
import { getModelById } from "./glPort/Model";
let fps = 50;
let frameTime = 1000/fps;
let gl:WebGLRenderingContext;
let graphics: Graphics;
let shader: Shader;
let canvas: HTMLCanvasElement;
function startGL() {
canvas = document.getElementById("glCanvas") as HTMLCanvasElement;
let canvasStyle = window.getComputedStyle(canvas);
canvas.setAttribute("width", canvasStyle.width);
canvas.setAttribute("height", canvasStyle.height);
gl = canvas.getContext("webgl") as WebGLRenderingContext;
graphics = new Graphics(gl, canvas.width, canvas.height);
graphics.init();
loadScene(graphics);
}
function draw() {
graphics.begin();
drawScene(graphics);
graphics.end();
setTimeout(draw, frameTime);
}
function getCanvas(): HTMLCanvasElement {
return canvas;
}
startGL();
draw();
export { fps, frameTime, getCanvas };