|
@@ -579,7 +579,7 @@
|
|
|
// GL
|
|
|
if (!options.disableWebGL2Support) {
|
|
|
try {
|
|
|
- this._gl = <WebGLRenderingContext>(canvas.getContext("webgl2", options) || canvas.getContext("experimental-webgl2", options));
|
|
|
+ this._gl = <WebGL2RenderingContext>(canvas.getContext("webgl2", options) || canvas.getContext("experimental-webgl2", options));
|
|
|
if (this._gl) {
|
|
|
this._webGLVersion = 2.0;
|
|
|
}
|
|
@@ -1313,9 +1313,9 @@
|
|
|
this.bindUniformBuffer(ubo);
|
|
|
|
|
|
if (elements instanceof Float32Array) {
|
|
|
- this._gl.bufferData(this._gl.UNIFORM_BUFFER, <Float32Array>elements, this._gl.STATIC_DRAW);
|
|
|
+ this._gl.bufferData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, <Float32Array>elements, this._gl.STATIC_DRAW);
|
|
|
} else {
|
|
|
- this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(<number[]>elements), this._gl.STATIC_DRAW);
|
|
|
+ this._gl.bufferData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, new Float32Array(<number[]>elements), this._gl.STATIC_DRAW);
|
|
|
}
|
|
|
|
|
|
this.bindUniformBuffer(null);
|
|
@@ -1329,9 +1329,9 @@
|
|
|
this.bindUniformBuffer(ubo);
|
|
|
|
|
|
if (elements instanceof Float32Array) {
|
|
|
- this._gl.bufferData(this._gl.UNIFORM_BUFFER, <Float32Array>elements, this._gl.DYNAMIC_DRAW);
|
|
|
+ this._gl.bufferData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, <Float32Array>elements, this._gl.DYNAMIC_DRAW);
|
|
|
} else {
|
|
|
- this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(<number[]>elements), this._gl.DYNAMIC_DRAW);
|
|
|
+ this._gl.bufferData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, new Float32Array(<number[]>elements), this._gl.DYNAMIC_DRAW);
|
|
|
}
|
|
|
|
|
|
this.bindUniformBuffer(null);
|
|
@@ -1349,15 +1349,15 @@
|
|
|
|
|
|
if (count === undefined) {
|
|
|
if (elements instanceof Float32Array) {
|
|
|
- this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, <Float32Array>elements);
|
|
|
+ this._gl.bufferSubData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, offset, <Float32Array>elements);
|
|
|
} else {
|
|
|
- this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(<number[]>elements));
|
|
|
+ this._gl.bufferSubData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, offset, new Float32Array(<number[]>elements));
|
|
|
}
|
|
|
} else {
|
|
|
if (elements instanceof Float32Array) {
|
|
|
- this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, <Float32Array>elements.subarray(offset, offset + count));
|
|
|
+ this._gl.bufferSubData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, 0, <Float32Array>elements.subarray(offset, offset + count));
|
|
|
} else {
|
|
|
- this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(<number[]>elements).subarray(offset, offset + count));
|
|
|
+ this._gl.bufferSubData((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, 0, new Float32Array(<number[]>elements).subarray(offset, offset + count));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1477,17 +1477,17 @@
|
|
|
}
|
|
|
|
|
|
public bindUniformBuffer(buffer?: WebGLBuffer): void {
|
|
|
- this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer);
|
|
|
+ this._gl.bindBuffer((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, buffer);
|
|
|
}
|
|
|
|
|
|
public bindUniformBufferBase(buffer: WebGLBuffer, location: number): void {
|
|
|
- this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer);
|
|
|
+ (<WebGL2RenderingContext>this._gl).bindBufferBase((<WebGL2RenderingContext>this._gl).UNIFORM_BUFFER, location, buffer);
|
|
|
}
|
|
|
|
|
|
public bindUniformBlock(shaderProgram: WebGLProgram, blockName: string, index: number): void {
|
|
|
- var uniformLocation = this._gl.getUniformBlockIndex(shaderProgram, blockName);
|
|
|
+ var uniformLocation = (<WebGL2RenderingContext>this._gl).getUniformBlockIndex(shaderProgram, blockName);
|
|
|
|
|
|
- this._gl.uniformBlockBinding(shaderProgram, uniformLocation, index);
|
|
|
+ (<WebGL2RenderingContext>this._gl).uniformBlockBinding(shaderProgram, uniformLocation, index);
|
|
|
};
|
|
|
|
|
|
private bindIndexBuffer(buffer: WebGLBuffer): void {
|