node-3d / glfw-raub

GLFW for Node.js
https://github.com/node-3d/node-3d
MIT License
57 stars 12 forks source link
addon bindings cpp gl glfw graphics javascript native node-3d opengl window

GLFW for Node.js

This is a part of Node3D project.

NPM ESLint Test Cpplint

npm i -s glfw-raub

Node.js addon with GLFW3 bindings.

Note: this addon uses N-API, and therefore is ABI-compatible across different Node.js versions. Addon binaries are precompiled and there is no compilation step during the npm i command.

Example

GLFW

This is a low-level interface, where most of the stuff is directly reflecting GLFW API. It does NOT EXPOSE OpenGL commands. See GLFW Docs for useful info on what it does and doesn't.

const glfw = require('glfw-raub');

Here glfw is an API container, where all glfw* functions are accessible as glfw.*. E.g. glfwSetWindowTitle -> glfw.setWindowTitle.

See TypeScript definitions for more details.


class Window

const { Window } = require('glfw-raub');

This class helps managing window objects and their events. It can also switch between fullscreen, borderless and windowed modes.

See TypeScript definitions for more details.


class Document

const { Document } = require('glfw-raub');

It can be used to facilitate the environment for other JS libraries, such as three.js.

See TypeScript definitions for more details.