Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/revery-ui/reason-glfw
Cross-platform GLFW / OpenGL ES / WebGL bindings for Reason
https://github.com/revery-ui/reason-glfw
cross-platform esy ocaml opengl opengles reason reasonml webgl
Last synced: 2 months ago
JSON representation
Cross-platform GLFW / OpenGL ES / WebGL bindings for Reason
- Host: GitHub
- URL: https://github.com/revery-ui/reason-glfw
- Owner: revery-ui
- License: mit
- Created: 2018-09-01T21:32:36.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-06T18:06:49.000Z (almost 5 years ago)
- Last Synced: 2024-04-12T13:08:34.507Z (9 months ago)
- Topics: cross-platform, esy, ocaml, opengl, opengles, reason, reasonml, webgl
- Language: C
- Homepage:
- Size: 828 KB
- Stars: 46
- Watchers: 9
- Forks: 17
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://bryphe.visualstudio.com/reason-glfw/_apis/build/status/bryphe.reason-glfw)](https://bryphe.visualstudio.com/reason-glfw/_build/latest?definitionId=9)
[![Build Status](https://travis-ci.org/bryphe/reason-glfw.svg?branch=master)](https://travis-ci.org/bryphe/reason-glfw)
[![npm version](https://badge.fury.io/js/reason-glfw.svg)](https://badge.fury.io/js/reason-glfw)# reason-glfw
#### Cross-platform Reason / OCaml bindings for GLFW - supports Native (OpenGL) and Javascript (WebGL))
## Building
`esy` is used for building, so if you don't have `esy`, install it:
```
npm install -g [email protected]
```- `esy install`
- `esy build`> __NOTE:__ If you've never built with `esy` before, the first compile could take some time - it builds the `ocaml` compiler as well as `cmake`. Incremental builds, though, are extremely fast!
## Running
A very simple example project is provided - you can test it out here:
__NATIVE:__
- `cd _build/install/default/bin`
- `./test_glfw` (`./test_glfw.exe` on Windows)__WEB:__
- Start an http-server at `_build/install/default/bin`. (I use `npm install -g http-server`).
- Navigate to `index.html`## License
This project is licensed under the MIT License - see [LICENSE](LICENSE) for more details.
## Design
For the most part, we strive to have API compatibility for [GLFW](https://glfw.org) and OpenGL. This library supports compilation to both native and JSOO targets. In the JSOO case, we emulate the GLFW APIs.
We do have some exceptions:
#### `glfwGetNativeWindow`
We wrap the [native window access](https://www.glfw.org/docs/latest/group__native.html) functions in a function `glfwGetNativeWindow`. This returns a `NativeWindow.t`, where the underlying value is platform specific:
- __Windows__ - `HWND` for the current window.
- __OSX__ - `void *` pointer to the `NSWindow`.
- __Linux__ - `void *` pointer to the X11 Window.
- __JS__ - `HTMLCanvasElement` representing the window.## Acknowledgements
- The test texture is provided by [LearnOpenGL](https://learnopengl.com) - an excellent resource for OpenGL!
- This is built on several great libraries, like [GLFW](https://www.glfw.org), [glad](https://github.com/Dav1dde/glad), [stb_image](https://github.com/nothings/stb/blob/master/stb_image.h)
- The test image is from @Arahnoid's [UVChecker-map](https://github.com/Arahnoid/UVChecker-map) repo.