forked from gabrielcuvillier/regal-emscripten-fixes
-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Werner Beroux edited this page May 13, 2019
·
4 revisions
Foreword: This is based on the very limited experience of myself as a user of this library. I'm not claiming anything below to be expert knowledge.
Regal adds support for older OpenGL functions that aren't natively supported by Emscripten even with -s LEGACY_GL_EMULATION=1
.
I'm assuming here that you're running a Linux shell with basic libraries.
For Ubuntu the dependencies (including Emscripten dependencies) may be like:
$ apt update && apt install -y \
build-essential \
curl \
libglu1-mesa-dev \
libsdl1.2-dev \
libxi-dev \
libxmu-dev \
python \
nodejs \
cmake \
default-jre
Then compile:
$ mkdir /opt/regal
$ curl -L https://github.com/emscripten-ports/regal/tarball/master | tar xz --strip-components=1 -C /opt/regal
$ cd /opt/regal
$ make -f Makefile.regal
Edit your source code like:
#ifdef __EMSCRIPTEN__
#include <GL/Regal.h> # Add this before OpenGL includes.
#include <GL/RegalGLU.h> # Optional.
#include <emscripten.h> # This you should already have.
#endif
#include <GL/glu.h> # Your existing OpenGL include should come after Regal.
Then after activating Emscripten, compile:
$ em++ src/*.cpp -lSDL -I/opt/regal/include -L/opt/regal/lib/linux -lRegal -lRegalGLU -s USE_REGAL=1
Note here:
- Add
-s USE_REGAL=1
to fix linking issues like https://github.com/p3/regal/issues/160 - Remove
-s LEGACY_GL_EMULATION=1