Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js drawing on screen [closed]

I've been looking all over the internet for this. I'd like to know if there is any Node.js packages/bindigs/libraries that allow you to make an application that draws on the screen without node-webkit(NW.js)/Electron or other implementations based on browsers. Maybe something that binds to opengl with support for 2D graphics?

Let me know if you know some names or links. If not I might have to write something myself.

Thank you guys.

like image 532
Zorgatone Avatar asked Nov 08 '15 16:11

Zorgatone


4 Answers

There is an experimental project : https://github.com/creationix/node-sdl

This basically provides bindings to the SDL library:

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.

If you can get it compiled, you can try the example scripts in nodejs.

like image 117
S.D. Avatar answered Oct 23 '22 04:10

S.D.


node-opencv or OpenCV in general should allow you this. At least it has a HighGUI class, which gives you native window contexts to display image data. With a lot of hacking you can build something you require. But I would suggest using browser contexts and HTMLCanvas anyhow. It gives you all you need out of the box. You just need to set it up properly.

Edit: As per @Zorgatone's suggestion, GTK could be a very good library for that purpose, though node bindings are very stale.

like image 30
eljefedelrodeodeljefe Avatar answered Oct 23 '22 04:10

eljefedelrodeodeljefe


There are projects that brings

  • QT bindings to node.js - https://github.com/arturadib/node-qt
  • GTK bindings - https://github.com/Tim-Smart/node-gtk
  • WxWidgets bindings - https://github.com/joeferner/wxNode

but unfortunately the last commits seem to be for old node.js versions.

It will be substantial work to make the bindings work with a recent version of node but those a interesting starting points.

like image 4
Jerome WAGNER Avatar answered Oct 23 '22 05:10

Jerome WAGNER


V8-GL intends to provide bindings for creating 2D-3D graphics on the desktop with javascript.The Status is not completed yet, but maybe it is enough for what you are trying to do https://github.com/philogb/V8-GL Another thing i just found out is, that it actually uses immediate mode, which is deprecated but still works.

like image 2
greedsin Avatar answered Oct 23 '22 04:10

greedsin