本文整理匯總了TypeScript中neuroglancer/webgl/context.GL.uniformMatrix4fv方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript GL.uniformMatrix4fv方法的具體用法?TypeScript GL.uniformMatrix4fv怎麽用?TypeScript GL.uniformMatrix4fv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neuroglancer/webgl/context.GL
的用法示例。
在下文中一共展示了GL.uniformMatrix4fv方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: draw
draw(mat: Mat4, blend = true) {
let shader = this.trivialColorShader;
let gl = this.gl;
shader.bind();
gl.uniformMatrix4fv(shader.uniform('uProjectionMatrix'), false, mat);
let aVertexPosition = shader.attribute('aVertexPosition');
this.vertexBuffer.bindToVertexAttrib(aVertexPosition, 4);
let aColor = shader.attribute('aColor');
this.colorBuffer.bindToVertexAttrib(aColor, 4);
if (blend) {
gl.colorMask(false, false, false, true);
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.colorMask(true, true, true, true);
gl.enable(gl.BLEND);
gl.blendFunc(gl.ONE_MINUS_DST_ALPHA, gl.DST_ALPHA);
}
gl.lineWidth(1);
gl.drawArrays(gl.LINES, 0, 6);
if (blend) {
gl.disable(gl.BLEND);
}
gl.disableVertexAttribArray(aVertexPosition);
gl.disableVertexAttribArray(aColor);
}
示例2: enable
enable(shader: ShaderProgram, context: AnnotationRenderContext, callback: () => void) {
shader.bind();
const {gl} = this;
const {renderContext} = context;
const {annotationLayer} = context;
gl.uniformMatrix4fv(shader.uniform('uProjection'), false, context.projectionMatrix);
if (renderContext.emitPickID) {
gl.uniform1ui(shader.uniform('uPickID'), context.basePickId);
}
if (renderContext.emitColor) {
const colorVec4 = tempPickID;
const color = annotationLayer.state.color.value;
colorVec4[0] = color[0];
colorVec4[1] = color[1];
colorVec4[2] = color[2];
colorVec4[3] = 1;
gl.uniform4fv(shader.uniform('uColor'), colorVec4);
const saturationAmount = 0.75;
for (let i = 0; i < 3; ++i) {
colorVec4[i] = saturationAmount + (1 - saturationAmount) * colorVec4[i];
}
gl.uniform4fv(shader.uniform('uColorSelected'), colorVec4);
gl.uniform1ui(shader.uniform('uSelectedIndex'), context.selectedIndex);
}
callback();
}