aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webGLClient.js1
-rw-r--r--src/webGLWorker.js11
-rw-r--r--tests/test_browser.py2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/webGLClient.js b/src/webGLClient.js
index 97d4e37f..0b646ac2 100644
--- a/src/webGLClient.js
+++ b/src/webGLClient.js
@@ -11,6 +11,7 @@ function WebGLClient() {
switch (command) {
case 'deleteShader':
case 'deleteProgram':
+ case 'deleteTexture':
case 'getProgramParameter':
case 'getShaderParameter':
case 'uniform1i':
diff --git a/src/webGLWorker.js b/src/webGLWorker.js
index ff4d94f9..1d45ad05 100644
--- a/src/webGLWorker.js
+++ b/src/webGLWorker.js
@@ -22,6 +22,7 @@ function WebGLRenderbuffer(id) {
function WebGLTexture(id) {
this.what = 'texture';
this.id = id;
+ this.binding = 0;
}
function WebGLWorker() {
@@ -34,7 +35,7 @@ function WebGLWorker() {
var commandBuffer = [];
- var nextId = 1;
+ var nextId = 1; // valid ids are > 0
var bindings = {
texture2D: null,
@@ -717,6 +718,13 @@ function WebGLWorker() {
commandBuffer.push('createTexture', -1, id);
return new WebGLTexture(id);
};
+ this.deleteTexture = function(texture) {
+ commandBuffer.push('deleteTexture', 1, texture.id);
+ texture.id = 0;
+ };
+ this.isTexture = function(texture) {
+ return texture && texture.what === 'texture' && texture.id > 0 && texture.binding;
+ };
this.bindTexture = function(target, texture) {
switch (target) {
case that.TEXTURE_2D: {
@@ -724,6 +732,7 @@ function WebGLWorker() {
break;
}
}
+ texture.binding = target;
commandBuffer.push('bindTexture', 2, target, texture ? texture.id : 0);
};
this.texParameteri = function(target, pname, param) {
diff --git a/tests/test_browser.py b/tests/test_browser.py
index be84545b..a864f395 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -1550,7 +1550,7 @@ void *getBindBuffer() {
self.btest('cubegeom_pre2_vao2.c', reference='cubegeom_pre2_vao2.png', args=['-s', 'LEGACY_GL_EMULATION=1'])
def test_cube_explosion(self):
- self.btest('cube_explosion.c', reference='cube_explosion.png', args=['-s', 'LEGACY_GL_EMULATION=1'])
+ self.btest('cube_explosion.c', reference='cube_explosion.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True)
def test_glgettexenv(self):
self.btest('glgettexenv.c', args=['-s', 'LEGACY_GL_EMULATION=1'], expected=['1'])