Code coverage report for src/pixi/renderers/webgl/utils/WebGLShaderManager.js

Statements: 14.81% (4 / 27)      Branches: 100% (0 / 0)      Functions: 0% (0 / 4)      Lines: 14.81% (4 / 27)     

All files » src/pixi/renderers/webgl/utils\ » WebGLShaderManager.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60        1               1                                         1                           1                        
/**
 * @author Mat Groves http://matgroves.com/ @Doormat23
 */
 
PIXI.WebGLShaderManager = function(gl)
{
    this.setContext(gl);
 
    // the final one is used for the rendering strips
    //this.stripShader = new PIXI.StripShader(gl);
};
 
PIXI.WebGLShaderManager.prototype.setContext = function(gl)
{
    this.gl = gl;
    
    // the next one is used for rendering primatives
    this.primitiveShader = new PIXI.PrimitiveShader(gl);
 
    // this shader is used for the default sprite rendering
    this.defaultShader = new PIXI.PixiShader(gl);
 
    var shaderProgram = this.defaultShader.program;
 
    gl.useProgram(shaderProgram);
 
    gl.enableVertexAttribArray(this.defaultShader.aVertexPosition);
    gl.enableVertexAttribArray(this.defaultShader.colorAttribute);
    gl.enableVertexAttribArray(this.defaultShader.aTextureCoord);
 
    
};
 
PIXI.WebGLShaderManager.prototype.activatePrimitiveShader = function()
{
    var gl = this.gl;
 
    gl.useProgram(this.primitiveShader.program);
 
    gl.disableVertexAttribArray(this.defaultShader.aVertexPosition);
    gl.disableVertexAttribArray(this.defaultShader.colorAttribute);
    gl.disableVertexAttribArray(this.defaultShader.aTextureCoord);
 
    gl.enableVertexAttribArray(this.primitiveShader.aVertexPosition);
    gl.enableVertexAttribArray(this.primitiveShader.colorAttribute);
};
 
PIXI.WebGLShaderManager.prototype.deactivatePrimitiveShader = function()
{
    var gl = this.gl;
 
    gl.useProgram(this.defaultShader.program);
 
    gl.disableVertexAttribArray(this.primitiveShader.aVertexPosition);
    gl.disableVertexAttribArray(this.primitiveShader.colorAttribute);
 
    gl.enableVertexAttribArray(this.defaultShader.aVertexPosition);
    gl.enableVertexAttribArray(this.defaultShader.colorAttribute);
    gl.enableVertexAttribArray(this.defaultShader.aTextureCoord);
};