aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 7e9a20d2..2be881df 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -10,12 +10,12 @@ var LibraryGL = {
glGetString: function(name_) {
switch(name_) {
- case Module.ctxGL.VENDOR:
- case Module.ctxGL.RENDERER:
- case Module.ctxGL.VERSION:
- return allocate(intArrayFromString(Module.ctxGL.getParameter(name_)), 'i8', ALLOC_NORMAL);
+ case Module.ctx.VENDOR:
+ case Module.ctx.RENDERER:
+ case Module.ctx.VERSION:
+ return allocate(intArrayFromString(Module.ctx.getParameter(name_)), 'i8', ALLOC_NORMAL);
case 0x1F03: // Extensions
- return allocate(intArrayFromString(Module.ctxGL.getSupportedExtensions().join(' ')), 'i8', ALLOC_NORMAL);
+ return allocate(intArrayFromString(Module.ctx.getSupportedExtensions().join(' ')), 'i8', ALLOC_NORMAL);
default:
throw 'Failure: Invalid glGetString value: ' + name_;
}
@@ -23,8 +23,8 @@ var LibraryGL = {
glGetIntegerv: function(name_, p) {
switch(name_) {
- case Module.ctxGL.MAX_TEXTURE_SIZE:
- IHEAP[p] = Module.ctxGL.getParameter(name_);
+ case Module.ctx.MAX_TEXTURE_SIZE:
+ IHEAP[p] = Module.ctx.getParameter(name_);
break;
default:
throw 'Failure: Invalid glGetIntegerv value: ' + name_;
@@ -35,7 +35,7 @@ var LibraryGL = {
glGenTextures: function(n, textures) {
for (var i = 0; i < n; i++) {
var id = GL.textureCounter++;
- GL.textures[id] = Module.ctxGL.createTexture();
+ GL.textures[id] = Module.ctx.createTexture();
IHEAP[textures+QUANTUM_SIZE*i] = id;
}
},
@@ -43,7 +43,7 @@ var LibraryGL = {
glDeleteTextures: function(n, textures) {
for (var i = 0; i < n; i++) {
var id = IHEAP[textures+QUANTUM_SIZE*i];
- Module.ctxGL.deleteTexture(GL.textures[id]);
+ Module.ctx.deleteTexture(GL.textures[id]);
delete GL.textures[id];
}
},
@@ -52,34 +52,34 @@ var LibraryGL = {
if (pixels) {
pixels = new Uint8Array(IHEAP.slice(pixels, pixels + width*height*4)); // TODO: optimize
}
- Module.ctxGL.texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+ Module.ctx.texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
},
glTexSubImage2D: function(target, level, xoffset, yoffset, width, height, format, type, pixels) {
if (pixels) {
pixels = new Uint8Array(IHEAP.slice(pixels, pixels + width*height*4)); // TODO: optimize
}
- Module.ctxGL.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+ Module.ctx.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
},
glBindTexture: function(target, texture) {
- Module.ctxGL.bindTexture(target, GL.textures[texture]);
+ Module.ctx.bindTexture(target, GL.textures[texture]);
},
glClearColor: function(red, green, blue, alpha) {
- Module.ctxGL.clearColor(red, green, blue, alpha);
+ Module.ctx.clearColor(red, green, blue, alpha);
},
glClear: function(mask) {
- Module.ctxGL.clear(mask);
+ Module.ctx.clear(mask);
},
glEnable: function(cap) {
- Module.ctxGL.enable(cap);
+ Module.ctx.enable(cap);
},
glScissor: function(x, y, width, height) {
- Module.ctxGL.scissor(x, y, width, height);
+ Module.ctx.scissor(x, y, width, height);
},
};
@@ -99,7 +99,7 @@ var LibraryGL = {
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.ctxGL.NAME(' + args + ')' : '') + ' })';
+ var stub = '(function(' + args + ') { ' + (num > 0 ? 'Module.ctx.NAME(' + args + ')' : '') + ' })';
names.split(' ').forEach(function(name_) {
var cName = 'gl' + name_[0].toUpperCase() + name_.substr(1);
LibraryGL[cName] = eval(stub.replace('NAME', name_));