// Class: openfl._internal.renderer.opengl.GLShaderManager

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../../../hxClasses_stub").default;
var $import = require("./../../../../import_stub").default;
var $extend = require("./../../../../extend_stub").default;
function openfl__$internal_renderer_AbstractShaderManager() {return require("./../../../../openfl/_internal/renderer/AbstractShaderManager");}
function openfl_display_Shader() {return require("./../../../../openfl/display/Shader");}

// Constructor

var GLShaderManager = function(gl) {
	(openfl__$internal_renderer_AbstractShaderManager().default).call(this);
	this.gl = gl;
	this.defaultShader = new (openfl_display_Shader().default)();
	this.initShader(this.defaultShader);
}

// Meta

GLShaderManager.__name__ = ["openfl","_internal","renderer","opengl","GLShaderManager"];
GLShaderManager.__super__ = (openfl__$internal_renderer_AbstractShaderManager().default);
GLShaderManager.prototype = $extend((openfl__$internal_renderer_AbstractShaderManager().default).prototype, {
	initShader: function(shader) {
		if(shader != null) {
			if(shader.gl == null) {
				shader.gl = this.gl;
				shader.__init();
			}
			return shader;
		}
		return this.defaultShader;
	},
	setShader: function(shader) {
		if(this.currentShader == shader) {
			return;
		}
		if(this.currentShader != null) {
			this.currentShader.__disable();
		}
		if(shader == null) {
			this.currentShader = null;
			this.gl.useProgram(null);
			return;
		} else {
			this.currentShader = shader;
			this.initShader(shader);
			this.gl.useProgram(shader.glProgram);
			this.currentShader.__enable();
		}
	},
	updateShader: function(shader) {
		if(this.currentShader != null) {
			this.currentShader.__update();
		}
	}
});
GLShaderManager.prototype.__class__ = $hxClasses["openfl._internal.renderer.opengl.GLShaderManager"] = GLShaderManager;

// Init



// Statics




// Export

exports.default = GLShaderManager;