@natoune/glfw-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

glfwJS

The N-API bindings for GLFW multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.

Example

if (!glfwInit()) {
  process.exit(1);
}

const window = glfwCreateWindow(kWidth, kHeight, "Simple example", null, null);
if (!window) {
  glfwTerminate();
  process.exit(1);
}
glfwMakeContextCurrent(window);

glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);

function drawLoop() {
  if (!glfwWindowShouldClose(window)) {
    setTimeout(drawLoop, 0);
  } else {
    glfwDestroyWindow(window);
    glfwTerminate();
    process.exit(0);
  }

  glfwSwapBuffers(window);
  glfwPollEvents();
}
drawLoop();

Documentation

The documentation for the latest version is available here.

Package Sidebar

Install

npm i @natoune/glfw-js

Weekly Downloads

4

Version

0.0.6

License

MIT

Unpacked Size

53.7 MB

Total Files

507

Last publish

Collaborators

  • natoune