UNPKG

openfl

Version:

A fast, productive library for 2D cross-platform development.

68 lines (50 loc) 2.22 kB
// Class: lime.graphics.opengl._GLShader.GLShader_Impl_ 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 $hxEnums = require("./../../../../hxEnums_stub").default; var $import = require("./../../../../import_stub").default; function lime_utils_Log() {return require("./../../../../lime/utils/Log");} // Constructor var GLShader_Impl_ = function(){} // Meta GLShader_Impl_.__name__ = "lime.graphics.opengl._GLShader.GLShader_Impl_"; GLShader_Impl_.__isInterface__ = false; GLShader_Impl_.prototype = { }; GLShader_Impl_.prototype.__class__ = GLShader_Impl_.prototype.constructor = $hxClasses["lime.graphics.opengl._GLShader.GLShader_Impl_"] = GLShader_Impl_; // Init // Statics GLShader_Impl_.fromSource = function(gl,source,type) { var shader = gl.createShader(type); gl.shaderSource(shader,source); gl.compileShader(shader); var shaderInfoLog = gl.getShaderInfoLog(shader); var compileStatus = gl.getShaderParameter(shader,gl.COMPILE_STATUS); if(shaderInfoLog != null || compileStatus == 0) { var message; if(compileStatus == 0) { message = "Error "; } else { message = "Info "; } if(type == gl.VERTEX_SHADER) { message = "compiling vertex shader"; } else if(type == gl.FRAGMENT_SHADER) { message = "compiling fragment shader"; } else { message = "compiling unknown shader type"; } message += "\n" + shaderInfoLog; if(compileStatus == 0) { (lime_utils_Log().default).error(message,{ fileName : "../node_modules/lime/src/lime/graphics/opengl/GLShader.hx", lineNumber : 47, className : "lime.graphics.opengl._GLShader.GLShader_Impl_", methodName : "fromSource"}); } else if(shaderInfoLog != null) { (lime_utils_Log().default).debug(message,{ fileName : "../node_modules/lime/src/lime/graphics/opengl/GLShader.hx", lineNumber : 48, className : "lime.graphics.opengl._GLShader.GLShader_Impl_", methodName : "fromSource"}); } } return shader; } // Export exports.default = GLShader_Impl_;