Closed justgook closed 4 years ago
Hello. I see a possible fix for this. But I don't have any means to test it on a real Retina. So I'll write back as soon as it will be ready for test.
looks like that is just webGL example problem - that just must be added devicePixelRatio
BTW - great project have no clue why i not faced it before
https://github.com/node-3d/glfw-raub/releases/tag/4.2.0-rc Please try an OSX binary from this pre-release, just unpack and replace it in your node_modules dir.
https://github.com/node-3d/webgl-raub/blob/master/examples/lesson05.js
When Start APP:
When Resize Window:
https://github.com/node-3d/glfw-raub/blob/master/js/window.js#L221
Now some JS has to be touched, this.emit('resize', this.framebufferSize);
will probably do the trick for the correct initial size. If so, I'll pack a new release with these fixes.
looks like that is not really correct place for change:
this.emit('resize', this.framebufferSize);
- have no effect
setTimeout(()=>this.emit('resize', this.framebufferSize), 0);
- works (but that is really bad way)
Oh I see now, the example also tries to get width/height from "canvas" (line 59), so the changes should get a bit more thorough. But we're on the right track... I'll notify you when there is something to try.
BTW, did you try 3d-core-raub (it doesn't fix the issue, but still)? It has THREEJS bundled and some more stuff.
im planing it to use for something different: there is language Elm, it have it own implementation of webGL after that there is nice playground "framework" - that i forked - and created WebGL version of that..
My target is using that fork create application, that can run in glfw-openGL, from Node, that i then pack into singe executable by use of pkg
btw - all steps looks like work - need to do some clean up - and that issue was just on track while i was investigating.
any way i need custom mock of Document and Window - so that "ready to use solution" isn't for me
BTW - here is Example Game that i would like wrap into "native"
Can you try the tag v4.2.0-rc2 for a possible fix?
I updated both binaries and js to use mostly logical sizes. Now I wonder what does cursor position report, because GLFW doc says it is in "screen coordinates" anyway.
Fixed in glfw-raub@4.2.0
When you ran example on Retina display (devicePixelRatio = 2)