aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-06 11:39:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-06 16:49:49 -0700
commit3ef0364bbda11df569a8e11254138c6b0b7b17c6 (patch)
tree94e8cccf5409d9a5be95905a3b7ff00662cdc0b3 /src/library_gl.js
parent6af006a1778d90d381502d4cef847b311ba767e5 (diff)
gl support comment
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js24
1 files changed, 23 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: {