aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjuj <jujjyl@gmail.com>2013-09-24 11:48:22 -0700
committerjuj <jujjyl@gmail.com>2013-09-24 11:48:22 -0700
commitbcc4e1636368a68193efbc09c68a4366a23ff74a (patch)
treed5517a401c172354cc0ed4b4445aaf6aa10f5585 /src
parent8e2d812b49f7de9487e1c816229106af0cf39d0d (diff)
parentf5a688b42f08f0ebeac2ecb3c7172d7c4f65a148 (diff)
Merge pull request #1658 from juj/WEBGL_depth_texture
Webgl depth texture
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 16ea5531..32a2596e 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -217,6 +217,23 @@ var LibraryGL = {
throw 'Invalid format (' + format + ')';
}
break;
+ case 0x1403 /* GL_UNSIGNED_SHORT */:
+ if (format == 0x1902 /* GL_DEPTH_COMPONENT */) {
+ sizePerPixel = 2;
+ } else {
+ throw 'Invalid format (' + format + ')';
+ }
+ break;
+ case 0x1405 /* GL_UNSIGNED_INT */:
+ if (format == 0x1902 /* GL_DEPTH_COMPONENT */) {
+ sizePerPixel = 4;
+ } else {
+ throw 'Invalid format (' + format + ')';
+ }
+ break;
+ case 0x84FA /* UNSIGNED_INT_24_8_WEBGL */:
+ sizePerPixel = 4;
+ break;
case 0x8363 /* GL_UNSIGNED_SHORT_5_6_5 */:
case 0x8033 /* GL_UNSIGNED_SHORT_4_4_4_4 */:
case 0x8034 /* GL_UNSIGNED_SHORT_5_5_5_1 */:
@@ -244,6 +261,8 @@ var LibraryGL = {
pixels = {{{ makeHEAPView('U8', 'pixels', 'pixels+bytes') }}};
} else if (type == 0x1406 /* GL_FLOAT */) {
pixels = {{{ makeHEAPView('F32', 'pixels', 'pixels+bytes') }}};
+ } else if (type == 0x1405 /* GL_UNSIGNED_INT */ || type == 0x84FA /* UNSIGNED_INT_24_8_WEBGL */) {
+ pixels = {{{ makeHEAPView('U32', 'pixels', 'pixels+bytes') }}};
} else {
pixels = {{{ makeHEAPView('U16', 'pixels', 'pixels+bytes') }}};
}
@@ -334,6 +353,10 @@ var LibraryGL = {
GL.elementIndexUintExt = Module.ctx.getExtension('OES_element_index_uint');
GL.standardDerivativesExt = Module.ctx.getExtension('OES_standard_derivatives');
+
+ GL.depthTextureExt = Module.ctx.getExtension("WEBGL_depth_texture") ||
+ Module.ctx.getExtension("MOZ_WEBGL_depth_texture") ||
+ Module.ctx.getExtension("WEBKIT_WEBGL_depth_texture");
}
},