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

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_AbstractBlendModeManager() {return require("./../../../../openfl/_internal/renderer/AbstractBlendModeManager");}

// Constructor

var GLBlendModeManager = function(gl) {
	(openfl__$internal_renderer_AbstractBlendModeManager().default).call(this);
	this.gl = gl;
	this.setBlendMode("normal");
	gl.enable(gl.BLEND);
}

// Meta

GLBlendModeManager.__name__ = ["openfl","_internal","renderer","opengl","GLBlendModeManager"];
GLBlendModeManager.__super__ = (openfl__$internal_renderer_AbstractBlendModeManager().default);
GLBlendModeManager.prototype = $extend((openfl__$internal_renderer_AbstractBlendModeManager().default).prototype, {
	setBlendMode: function(blendMode) {
		if(this.currentBlendMode == blendMode) {
			return;
		}
		this.currentBlendMode = blendMode;
		switch(blendMode) {
		case "add":
			this.gl.blendEquation(this.gl.FUNC_ADD);
			this.gl.blendFunc(this.gl.ONE,this.gl.ONE);
			break;
		case "multiply":
			this.gl.blendEquation(this.gl.FUNC_ADD);
			this.gl.blendFunc(this.gl.DST_COLOR,this.gl.ONE_MINUS_SRC_ALPHA);
			break;
		case "screen":
			this.gl.blendEquation(this.gl.FUNC_ADD);
			this.gl.blendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_COLOR);
			break;
		case "subtract":
			this.gl.blendEquation(this.gl.FUNC_REVERSE_SUBTRACT);
			this.gl.blendFunc(this.gl.ONE,this.gl.ONE);
			break;
		default:
			this.gl.blendEquation(this.gl.FUNC_ADD);
			this.gl.blendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA);
		}
	}
});
GLBlendModeManager.prototype.__class__ = $hxClasses["openfl._internal.renderer.opengl.GLBlendModeManager"] = GLBlendModeManager;

// Init



// Statics




// Export

exports.default = GLBlendModeManager;