mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Shinobi CE officially lands on Gitlab
This commit is contained in:
commit
f1406d4eec
431 changed files with 118157 additions and 0 deletions
32
tools/ffmpegToWeb/Player/broadway/canvas/Program.js
Normal file
32
tools/ffmpegToWeb/Player/broadway/canvas/Program.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
var assert = require('../utils/assert');
|
||||
|
||||
|
||||
function Program(gl) {
|
||||
this.gl = gl;
|
||||
this.program = this.gl.createProgram();
|
||||
}
|
||||
|
||||
Program.prototype = {
|
||||
attach: function (shader) {
|
||||
this.gl.attachShader(this.program, shader.shader);
|
||||
},
|
||||
link: function () {
|
||||
this.gl.linkProgram(this.program);
|
||||
// If creating the shader program failed, alert.
|
||||
assert(this.gl.getProgramParameter(this.program, this.gl.LINK_STATUS),
|
||||
"Unable to initialize the shader program.");
|
||||
},
|
||||
use: function () {
|
||||
this.gl.useProgram(this.program);
|
||||
},
|
||||
getAttributeLocation: function(name) {
|
||||
return this.gl.getAttribLocation(this.program, name);
|
||||
},
|
||||
setMatrixUniform: function(name, array) {
|
||||
var uniform = this.gl.getUniformLocation(this.program, name);
|
||||
this.gl.uniformMatrix4fv(uniform, false, array);
|
||||
}
|
||||
};
|
||||
module.exports = Program;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue