var OffsetBuffer;
OffsetBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, OffsetBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(layer.mesh.Buffer1), gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, OffsetBuffer); //gl.bindBuffer(gl.ARRAY_BUFFER, layer.mesh.Buffer1);
gl.vertexAttribPointer(layer.shader.attributeSpecs.offset.position, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(layer.shader.attributeSpecs.offset.position);
this.instanceExt.vertexAttribDivisorANGLE(layer.shader.attributeSpecs.offset.position, 1);
this.instanceExt.drawElementsInstancedANGLE(gl[renderState.polygonDrawMode], layer.mesh.numIndices, gl.UNSIGNED_SHORT, 0, layer.mesh.instanceCount);
attribute vec3 PosO : POSITION;
attribute vec2 TexCd : TEXCOORD0;
attribute vec3 NormO : NORMAL;
attribute vec3 offset : OFFSET;
void main(void) {
mat4 tWV = tV * tW;
mat4 tWVP = tP * tWV;
LightDirV = normalize(-1.0*(tV*vec4(Light_Direction_XYZ,1))).xyz;
NormV = normalize(tWV * vec4(NormO, 0)).xyz;
vec4 PosV = tWV * vec4(PosO, 1);
ViewDirV = normalize(-PosV).xyz;
gl_Position = tWVP * vec4(PosO + offset, 1.0);
vs2psTexCd = (Texture_Transform * vec4(TexCd, 0, 1)).xy;
}
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-list+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
for (var i=0; i<layer.mesh.semantics.length; i++) {
var semantic = layer.mesh.semantics[i];
gl.bindBuffer(gl.ARRAY_BUFFER, layer.mesh.instanceBuffers[i]);
gl.enableVertexAttribArray(layer.shader.attributeSpecs[semantic].position);
gl.vertexAttribPointer(layer.shader.attributeSpecs[semantic].position, layer.mesh.VectorSize[i], gl.FLOAT, false, 0, 0);
this.instanceExt.vertexAttribDivisorANGLE(layer.shader.attributeSpecs[semantic].position, 1);
}
...
this.instanceExt.drawElementsInstancedANGLE(gl[renderState.polygonDrawMode], layer.mesh.numIndices, gl.UNSIGNED_SHORT, 0, layer.mesh.instanceCount);