aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-05-13 14:43:59 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-05-13 14:43:59 -0700
commitc5a1ea080c39e0d414207db21ee4fcf9106a91db (patch)
tree4ab265b344f5f6c0e4416758c3efa0eda69d8108
parentc4a559e14fac206aa42d112aee7eb62af4e5df9c (diff)
library stuff
-rw-r--r--src/library.js5
-rw-r--r--src/library_gl.js29
2 files changed, 30 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js
index 2f9fbdbd..e3b6f964 100644
--- a/src/library.js
+++ b/src/library.js
@@ -844,6 +844,11 @@ var Library = {
return (chr >= 0 && chr <= 0x1f) || chr === 0x7f;
},
+ isprint__deps: ['iscntrl'],
+ isprint: function(chr) {
+ return !_iscntrl(chr);
+ },
+
toupper: function(chr) {
if (chr >= 'a'.charCodeAt(0) && chr <= 'z'.charCodeAt(0)) {
return chr - 'a'.charCodeAt(0) + 'A'.charCodeAt(0);
diff --git a/src/library_gl.js b/src/library_gl.js
index f69d3301..3da67c80 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1,4 +1,4 @@
-mergeInto(Library, {
+var LibraryGL = {
glGetString: function(name_) {
switch(name_) {
case Module.contextGL.VENDOR:
@@ -10,10 +10,31 @@ mergeInto(Library, {
default:
throw 'Failure: Invalid glGetString value: ' + name_;
}
- }
+ },
-// glGenVertexArrays: function() {},
+ glGetIntegerv: function(name_) {
+ switch(name_) {
+ case Module.contextGL.MAX_TEXTURE_SIZE:
+ return Module.contextGL.getParameter(name_);
+ default:
+ throw 'Failure: Invalid glGetIntegerv value: ' + name_;
+ }
+ }
+};
-// glBindVertexArray: function() {},
+[[0, 'shadeModel fogi fogfv'],
+ [1, 'clearDepth depthFunc enable disable frontFace cullFace'],
+ [4, 'viewport clearColor']].forEach(function(data) {
+ var num = data[0];
+ var names = data[1];
+ var args = range(num).map(function(i) { return 'x' + i }).join(', ');
+ var stub = '(function(' + args + ') { ' + (num > 0 ? 'Module.contextGL.NAME(' + args + ')' : '') + ' })';
+ names.split(' ').forEach(function(name_) {
+ var cName = 'gl' + name_[0].toUpperCase() + name_.substr(1);
+ LibraryGL[cName] = eval(stub.replace('NAME', name_));
+ //print(cName + ': ' + LibraryGL[cName]);
+ });
});
+mergeInto(Library, LibraryGL);
+