-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraubtest.js
71 lines (45 loc) · 1.36 KB
/
raubtest.js
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const glfw = require("glfw-raub")
const { Window } = glfw;
//const gl = require("webgl-raub");
const { gl } = require("3d-core-raub");
const w1 = new Window({ title: 'GLFW Simple Test 1' });
const w2 = new Window({ title: 'GLFW Simple Test 2' });
// testing events
w1.on('mousemove', e => console.log(`[#1 mousemove] ${e.x}, ${e.y}`));
w2.on('mousemove', e => console.log(`[#2 mousemove] ${e.x}, ${e.y}`));
console.log(w1.version);
w1.makeCurrent();
gl.enable(gl.POINT_SPRITE); // GL_POINT_SPRITE 0x8861
gl.enable(0x8642); // GL_VERTEX_PROGRAM_POINT_SIZE
gl.enable(0x8862); // GL_COORD_REPLACE
w2.makeCurrent();
gl.enable(gl.POINT_SPRITE); // GL_POINT_SPRITE 0x8861
gl.enable(0x8642); // GL_VERTEX_PROGRAM_POINT_SIZE
gl.enable(0x8862); // GL_COORD_REPLACE
const draw = () => {
w1.makeCurrent();
const wsize1 = w1.framebufferSize;
glfw.testScene(wsize1.width, wsize1.height);
w1.swapBuffers();
w2.makeCurrent();
const wsize2 = w2.framebufferSize;
glfw.testScene(wsize2.width, wsize2.height);
w2.swapBuffers();
glfw.pollEvents();
};
const animate = () => {
if ( ! (
w1.shouldClose || w2.shouldClose ||
w1.getKey(glfw.KEY_ESCAPE) || w2.getKey(glfw.KEY_ESCAPE)
) ) {
draw();
setTimeout(animate, 16);
} else {
// Close OpenGL window and terminate GLFW
w1.destroy();
w2.destroy();
glfw.terminate();
process.exit(0);
}
};
animate();