aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-03 11:39:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-03 11:39:31 -0800
commit519efb8e48baa01d4af89cb66dc060da18e439b2 (patch)
tree125eac0cb976ceb9c5fa3c19249c2472a22f95eb /src
parent5528ef9f827a475d71574b56783f8d4d07637f60 (diff)
properly handle getParameter returning null when it means a null object (e.g., no buffer is bound) and not an invalid name
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 6af4a86c..6575a911 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -268,11 +268,27 @@ var LibraryGL = {
return;
case "object":
if (result === null) {
- GL.recordError(0x0500); // GL_INVALID_ENUM
+ // null is a valid result for some (e.g., which buffer is bound - perhaps nothing is bound), but otherwise
+ // can mean an invalid name_, which we need to report as an error
+ switch(name_) {
+ case 0x8894: // ARRAY_BUFFER_BINDING
+ case 0x8B8D: // CURRENT_PROGRAM
+ case 0x8895: // ELEMENT_ARRAY_BUFFER_BINDING
+ case 0x8CA6: // FRAMEBUFFER_BINDING
+ case 0x8CA7: // RENDERBUFFER_BINDING
+ case 0x8069: // TEXTURE_BINDING_2D
+ case 0x8514: { // TEXTURE_BINDING_CUBE_MAP
+ ret = 0;
+ break;
+ }
+ default: {
+ GL.recordError(0x0500); // GL_INVALID_ENUM
#if GL_ASSERTIONS
- Module.printErr('GL_INVALID_ENUM in glGet' + type + 'v(' + name_ + ') and it returns null!');
+ Module.printErr('GL_INVALID_ENUM in glGet' + type + 'v(' + name_ + ') and it returns null!');
#endif
- return;
+ return;
+ }
+ }
} else if (result instanceof Float32Array ||
result instanceof Uint32Array ||
result instanceof Int32Array ||