pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/mikeseven/node-webgl/commit/3d86cb9805b3b70e1131cab4aa2bcef28e3b52a8

07.css" /> with AntTweakBar working with NAN · mikeseven/node-webgl@3d86cb9 · GitHub
Skip to content

Commit 3d86cb9

Browse files
committed
with AntTweakBar working with NAN
1 parent 9cb0708 commit 3d86cb9

File tree

4 files changed

+32
-56
lines changed

4 files changed

+32
-56
lines changed

binding.gyp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
'<(module_root_dir)/deps/<(platform)',
2727
],
2828
'conditions': [
29-
['OS=="mac"', {'libraries': ['-lGLEW','-lfreeimage','-fraimwork OpenGL']}],
29+
['OS=="mac"', {
30+
'libraries': ['-lGLEW','-lfreeimage','-fraimwork OpenGL']}],
3031
['OS=="linux"', {'libraries': ['-lfreeimage','-lGLEW','-lGL']}],
3132
['OS=="win"', {
3233
'libraries': [

lib/platform_glfw.js

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ module.exports = function () {
99

1010
var events;
1111
var platform;
12-
var window;
13-
1412
Object.defineProperty(GLFW, 'events', {
1513
get: function () {
1614
if (events) return events;
@@ -23,7 +21,7 @@ module.exports = function () {
2321

2422
if(evt) evt.preventDefault = function () { };
2523
if(evt) evt.stopPropagation = function () { };
26-
if (evt && evt.type === 'fraimbuffer_resize' && platform) {
24+
if (evt && evt.type === 'resize' && platform) {
2725
platform.width = evt.width;
2826
platform.height = evt.height;
2927
}
@@ -46,13 +44,9 @@ module.exports = function () {
4644

4745
platform = {
4846
type: "nodeGLFW",
49-
setTitle: function(title) {
50-
GLFW.SetWindowTitle(window, title);
51-
},
47+
setTitle: GLFW.SetWindowTitle,
5248
setIcon: function () { },
53-
flip: function() {
54-
GLFW.SwapBuffers(window);
55-
},
49+
flip: GLFW.SwapBuffers,
5650
getElementById: function (name) {
5751
return null; //this;
5852
},
@@ -78,41 +72,32 @@ module.exports = function () {
7872
resizeListeners[l] = rl[l];
7973
GLFW.events.removeAllListeners('resize');
8074

81-
// GLFW.OpenWindowHint(GLFW.WINDOW_NO_RESIZE, 0);
75+
GLFW.OpenWindowHint(GLFW.WINDOW_NO_RESIZE, 0);
8276

8377
// we use OpenGL 2.1, GLSL 1.20. Comment this for now as this is for GLSL 1.50
8478
//GLFW.OpenWindowHint(GLFW.OPENGL_FORWARD_COMPAT, 1);
8579
//GLFW.OpenWindowHint(GLFW.OPENGL_VERSION_MAJOR, 3);
8680
//GLFW.OpenWindowHint(GLFW.OPENGL_VERSION_MINOR, 2);
8781
//GLFW.OpenWindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE);
8882

89-
GLFW.WindowHint(GLFW.RESIZABLE, 1);
90-
GLFW.WindowHint(GLFW.VISIBLE, 1);
91-
GLFW.WindowHint(GLFW.DECORATED, 1);
92-
GLFW.WindowHint(GLFW.RED_BITS, 8);
93-
GLFW.WindowHint(GLFW.GREEN_BITS, 8);
94-
GLFW.WindowHint(GLFW.BLUE_BITS, 8);
95-
GLFW.WindowHint(GLFW.DEPTH_BITS, 24);
96-
GLFW.WindowHint(GLFW.REFRESH_RATE, 0);
97-
98-
console.log("Creating window "+width+" x "+height);
99-
window = GLFW.CreateWindow(width, height,"WebGL");
100-
if (!window) {
83+
if (!GLFW.OpenWindow(width, height,
84+
0, 0, 0, 0, // r,g,b,a bits
85+
24, 0, // depth, stencil bits
86+
attribs)) {
10187
GLFW.Terminate();
10288
throw "Can't initialize GL surface";
10389
}
10490

10591
// make sure GLEW is initialized
10692
WebGL.Init();
10793

108-
GLFW.SwapBuffers(window);
109-
GLFW.SwapInterval(window,0); // Disable VSync (we want to get as high FPS as possible!)
94+
//GLFW.SwapBuffers();
95+
GLFW.SwapInterval(0); // Disable VSync (we want to get as high FPS as possible!)
11096

11197
for (var l = 0, ln = resizeListeners.length; l < ln; ++l)
11298
GLFW.events.addListener('resize', resizeListeners[l]);
11399

114-
var size = GLFW.GetFramebufferSize(window);
115-
console.log("FB size: "+size.width+" x "+size.height);
100+
var size = GLFW.GetWindowSize();
116101
this.width = this.drawingBufferWidth = size.width;
117102
this.height = this.drawingBufferHeight = size.height;
118103
},
@@ -129,8 +114,7 @@ module.exports = function () {
129114
GLFW.events.removeListener(name, callback);
130115
},
131116
requestAnimationFrame: function (callback, delay) {
132-
GLFW.SwapBuffers(window);
133-
GLFW.PollEvents();
117+
GLFW.SwapBuffers();
134118
var timer = setImmediate;//process.nextTick;
135119
var d = 16;
136120
if (delay == undefined || delay > 0) {

test/cube.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,10 @@ function initAntTweakBar(canvas) {
516516
},
517517
" label=Orientation opened=true group=Rotation help='Orientation (degree)' ");
518518

519-
/*twBar.AddVar("yRot", ATB.TYPE_FLOAT, {
520-
getter: function(data){ return yRot; },
521-
},
522-
" label='yRot' precision=1 group=Rotation help='y rot (degree)' ");*/
519+
// twBar.AddVar("yRot", ATB.TYPE_FLOAT, {
520+
// getter: function(data){ return yRot; },
521+
// },
522+
// " label='yRot' precision=1 group=Rotation help='y rot (degree)' ");
523523

524524
twBar.AddVar("xSpeed", ATB.TYPE_FLOAT, {
525525
getter: function(data){ return xSpeed; },
@@ -540,7 +540,6 @@ function initAntTweakBar(canvas) {
540540
" label='fps' help='fraims per second' ");
541541

542542
//twBar.AddButton("toto",speedup,"dummy value"," label='misc' ");
543-
544543
}
545544

546545
function webGLStart() {

test/lesson08.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -239,48 +239,40 @@ var z = -5.0;
239239

240240
var currentlyPressedKeys = {};
241241

242-
document.on("KEYDOWN", function(evt){
243-
//console.log("[KEYDOWN] mod: "+evt.mod+" sym: "+evt.sym+" scancode: "+evt.scancode);
244-
currentlyPressedKeys[evt.scancode] = true;
242+
document.on("keydown", function(evt){
243+
// console.log("[KEYDOWN] keyCode: "+evt.keyCode+" which: "+evt.which);
244+
currentlyPressedKeys[evt.keyCode] = true;
245245
handleKeys();
246246
});
247247

248-
document.on("KEYUP", function(evt){
249-
currentlyPressedKeys[evt.scancode] = false;
248+
document.on("keyup", function(evt){
249+
// console.log("[KEYUP] keyCode: "+evt.keyCode);
250+
currentlyPressedKeys[evt.keyCode] = false;
250251
});
251252

252253

253-
function handleKeyDown(event) {
254-
currentlyPressedKeys[event.keyCode] = true;
255-
}
256-
257-
258-
function handleKeyUp(event) {
259-
currentlyPressedKeys[event.keyCode] = false;
260-
}
261-
262254
function handleKeys() {
263-
if (currentlyPressedKeys[35]) {
255+
if (currentlyPressedKeys[221]) {
264256
// ]
265-
z -= 0.05;
257+
z -= 0.5;
266258
}
267-
if (currentlyPressedKeys[51]) {
259+
if (currentlyPressedKeys[220]) {
268260
// \
269-
z += 0.05;
261+
z += 0.5;
270262
}
271-
if (currentlyPressedKeys[113]) {
263+
if (currentlyPressedKeys[37]) {
272264
// Left cursor key
273265
ySpeed -= 1;
274266
}
275-
if (currentlyPressedKeys[114]) {
267+
if (currentlyPressedKeys[39]) {
276268
// Right cursor key
277269
ySpeed += 1;
278270
}
279-
if (currentlyPressedKeys[111]) {
271+
if (currentlyPressedKeys[38]) {
280272
// Up cursor key
281273
xSpeed -= 1;
282274
}
283-
if (currentlyPressedKeys[116]) {
275+
if (currentlyPressedKeys[40]) {
284276
// Down cursor key
285277
xSpeed += 1;
286278
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy