aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-31 12:50:11 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-03-31 14:17:29 -0700
commitb01c2fe8db794bc5bb32e56459b55deb4057c28c (patch)
tree9d6bde8c2f02ae0e00a6bb82fed49ab5f3e5de90
parent17c490cb18e834bed7874e8283feb3d6d9f38723 (diff)
do not fix offsets in renderers; fixes test_gl_renderers
-rw-r--r--src/library_gl.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index e8bda2bf..5c415b85 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1908,29 +1908,25 @@ var LibraryGL = {
createRenderer: function(renderer) {
var useCurrProgram = !!GL.currProgram;
- var hasTextures = false, textureSizes = [], textureTypes = [], textureOffsets = [];
+ var hasTextures = false, textureSizes = [], textureTypes = [];
for (var i = 0; i < GL.immediate.NUM_TEXTURES; i++) {
if (GL.immediate.enabledClientAttributes[GL.immediate.TEXTURE0 + i]) {
textureSizes[i] = GL.immediate.clientAttributes[GL.immediate.TEXTURE0 + i].size;
textureTypes[i] = GL.immediate.clientAttributes[GL.immediate.TEXTURE0 + i].type;
- textureOffsets[i] = GL.immediate.clientAttributes[GL.immediate.TEXTURE0 + i].offset;
hasTextures = true;
}
}
var positionSize = GL.immediate.clientAttributes[GL.immediate.VERTEX].size;
var positionType = GL.immediate.clientAttributes[GL.immediate.VERTEX].type;
- var positionOffset = GL.immediate.clientAttributes[GL.immediate.VERTEX].offset;
- var colorSize = 0, colorType, colorOffset;
+ var colorSize = 0, colorType;
if (GL.immediate.enabledClientAttributes[GL.immediate.COLOR]) {
colorSize = GL.immediate.clientAttributes[GL.immediate.COLOR].size;
colorType = GL.immediate.clientAttributes[GL.immediate.COLOR].type;
- colorOffset = GL.immediate.clientAttributes[GL.immediate.COLOR].offset;
}
- var normalSize = 0, normalType, normalOffset;
+ var normalSize = 0, normalType;
if (GL.immediate.enabledClientAttributes[GL.immediate.NORMAL]) {
normalSize = GL.immediate.clientAttributes[GL.immediate.NORMAL].size;
normalType = GL.immediate.clientAttributes[GL.immediate.NORMAL].type;
- normalOffset = GL.immediate.clientAttributes[GL.immediate.NORMAL].offset;
}
var ret = {
init: function() {
@@ -2103,13 +2099,13 @@ var LibraryGL = {
if (this.projectionLocation) Module.ctx.uniformMatrix4fv(this.projectionLocation, false, GL.immediate.matrix['p']);
Module.ctx.vertexAttribPointer(this.positionLocation, positionSize, positionType, false,
- GL.immediate.stride, positionOffset);
+ GL.immediate.stride, GL.immediate.clientAttributes[GL.immediate.VERTEX].offset);
Module.ctx.enableVertexAttribArray(this.positionLocation);
if (this.hasTextures) {
for (var i = 0; i < textureSizes.length; i++) {
if (textureSizes[i] && this.texCoordLocations[i] >= 0) {
Module.ctx.vertexAttribPointer(this.texCoordLocations[i], textureSizes[i], textureTypes[i], false,
- GL.immediate.stride, textureOffsets[i]);
+ GL.immediate.stride, GL.immediate.clientAttributes[GL.immediate.TEXTURE0 + i].offset);
Module.ctx.enableVertexAttribArray(this.texCoordLocations[i]);
}
}
@@ -2121,7 +2117,7 @@ var LibraryGL = {
}
if (this.hasColorAttrib) {
Module.ctx.vertexAttribPointer(this.colorLocation, colorSize, colorType, true,
- GL.immediate.stride, colorOffset);
+ GL.immediate.stride, GL.immediate.clientAttributes[GL.immediate.COLOR].offset);
Module.ctx.enableVertexAttribArray(this.colorLocation);
Module.ctx.uniform1i(this.hasColorAttribLocation, 1);
} else if (this.hasColorUniform) {
@@ -2130,7 +2126,7 @@ var LibraryGL = {
}
if (this.hasNormal) {
Module.ctx.vertexAttribPointer(this.normalLocation, normalSize, normalType, true,
- GL.immediate.stride, normalOffset);
+ GL.immediate.stride, GL.immediate.clientAttributes[GL.immediate.NORMAL].offset);
Module.ctx.enableVertexAttribArray(this.normalLocation);
}
if (!useCurrProgram) { // otherwise, the user program will set the sampler2D binding and uniform itself