aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js24
-rw-r--r--src/settings.js2
2 files changed, 25 insertions, 1 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 6f99969e..29e8423f 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1,4 +1,26 @@
-//"use strict";
+/*
+ * GL support.
+ *
+ * Emscripten supports the WebGL-friendly subset of OpenGL, basically what
+ * maps directly to WebGL. This includes almost all of OpenGL ES 2.0,
+ * except for client-side arrays. The reason they are missing from WebGL
+ * is because they are less efficient than properly using GPU-side data.
+ * Similarly, if we emulated client-side arrays here, we would end up
+ * with very bad performance, since we would need to upload the data
+ * on each call to glDrawArrays etc. (Even if there are two calls one
+ * after the other, we can't know the data did not change!) So in
+ * practical terms full OpenGL ES 2.0 emulation would be convenient,
+ * but lead to bad performance so in practice you would need to properly
+ * rewrite your code to a WebGL-friendly subset anyhow.
+ *
+ * Thankfully, rewriting to that subset is general fairly easy. See
+ * the files in tests/glbook for some simple examples ported to that
+ * subset.
+ *
+ * Regarding OpenGL aspects present on desktop GL or on OpenGL ES prior
+ * to 2.0, we also do not support immediate mode (glBegin/glEnd), GL_QUADS,
+ * etc. Some of these might make sense to emulate, some might not.
+ */
var LibraryGL = {
$GL: {
diff --git a/src/settings.js b/src/settings.js
index 901812b6..7df86c90 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -101,7 +101,9 @@ var SAFE_HEAP_LOG = 0; // Log out all SAFE_HEAP operations
var LABEL_DEBUG = 0; // Print out labels and functions as we enter them
var EXCEPTION_DEBUG = 1; // Print out exceptions in emscriptened code
var LIBRARY_DEBUG = 0; // Print out when we enter a library call (library*.js)
+
var GL_DEBUG = 0; // Print out all calls into WebGL
+
var DISABLE_EXCEPTION_CATCHING = 0; // Disables generating code to actually catch exceptions. If the code you
// are compiling does not actually rely on catching exceptions (but the
// compiler generates code for it, maybe because of stdlibc++ stuff),