internal WebGLShader GetShaderHandle() { // If the shader has already been created then return it. if (gl.isShader(_shaderHandle)) { return(_shaderHandle); } _shaderHandle = gl.createShader(Stage == ShaderStage.Vertex ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER); GraphicsExtensions.CheckGLError(); gl.shaderSource(_shaderHandle, _glslCode); GraphicsExtensions.CheckGLError(); gl.compileShader(_shaderHandle); GraphicsExtensions.CheckGLError(); var compiled = (bool)gl.getShaderParameter(_shaderHandle, gl.COMPILE_STATUS); GraphicsExtensions.CheckGLError(); if (!compiled) { var log = gl.getShaderInfoLog(_shaderHandle); Debug.WriteLine(log); GraphicsDevice.DisposeShader(_shaderHandle); throw new InvalidOperationException("Shader Compilation Failed"); } return(_shaderHandle); }
public void shaderSource(WebGLShader shader, string source) { #if _DEBUG Log.Info(string.Format("shaderSource {0}, source length {1}", shader.Value, source.Length)); #endif var bytes = Encoding.ASCII.GetBytes(source); var len = bytes.Length; unsafe { fixed(byte *b = &bytes[0]) { byte *[] barray = new byte *[] { b }; fixed(byte **pb = &barray[0]) { #if GLEW_STATIC Gl.glShaderSource(shader.Value, 1, pb, &len); #else Gl.__glewShaderSource(shader.Value, 1, pb, &len); #endif } } } this.ErrorTest(); }
public object getShaderParameter(WebGLShader shader, int pname) { var i = new int[1]; this.openGl.GetShader(shader.Value, (uint)pname, i); this.ErrorTest(); return(i[0] == 0 ? (object)null : i[0]); }
public static void Init(RenderContext renderContext) { GL gl = renderContext.gl; String fragShaderText = " precision highp float; \n" + " uniform vec4 lineColor; \n" + " \n" + " void main(void) { \n" + " gl_FragColor = lineColor; \n" + " } \n"; String vertexShaderText = " attribute vec3 aVertexPosition; \n" + " \n" + " uniform mat4 uMVMatrix; \n" + " uniform mat4 uPMatrix; \n" + " \n" + " \n" + " \n" + " void main(void) { \n" + " gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); \n" + " } \n" + " \n"; frag = gl.createShader(GL.FRAGMENT_SHADER); gl.shaderSource(frag, fragShaderText); gl.compileShader(frag); object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS); vert = gl.createShader(GL.VERTEX_SHADER); gl.shaderSource(vert, vertexShaderText); gl.compileShader(vert); object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS); prog = gl.createProgram(); gl.attachShader(prog, vert); gl.attachShader(prog, frag); gl.linkProgram(prog); object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS); gl.useProgram(prog); vertLoc = gl.getAttribLocation(prog, "aVertexPosition"); lineColorLoc = gl.getUniformLocation(prog, "lineColor"); projMatLoc = gl.getUniformLocation(prog, "uPMatrix"); mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix"); gl.enable(GL.BLEND); gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA); initialized = true; }
internal void DisposeShader(WebGLShader handle) { if (!_isDisposed) { lock (_disposeActionsLock) { _disposeNextFrame.Add(ResourceHandle.Shader(handle)); } } }
void IDisposable.Dispose() { if (DualityApp.ExecContext != DualityApp.ExecutionContext.Terminated && this.handle != null) { // Removed thread guards because of performance //DefaultOpenTKBackendPlugin.GuardSingleThreadState(); GraphicsBackend.GL.DeleteShader(this.handle); this.handle = null; } }
public void compile(WebGLRenderingContext webgl) { this.vs = webgl.CreateShader(webgl.VERTEX_SHADER); this.fs = webgl.CreateShader(webgl.FRAGMENT_SHADER); //分别编译shader webgl.ShaderSource(this.vs, this.vscode); webgl.CompileShader(this.vs); var r1 = webgl.GetShaderParameter(this.vs, webgl.COMPILE_STATUS); if (r1.As <bool>() == false) { alert(webgl.GetShaderInfoLog(this.vs)); } // webgl.ShaderSource(this.fs, this.fscode); webgl.CompileShader(this.fs); var r2 = webgl.GetShaderParameter(this.fs, webgl.COMPILE_STATUS); if (r2.As <bool>() == false) { alert(webgl.GetShaderInfoLog(this.fs)); } //program link this.program = webgl.CreateProgram().As <WebGLProgram>(); webgl.AttachShader(this.program, this.vs); webgl.AttachShader(this.program, this.fs); webgl.LinkProgram(this.program); var r3 = webgl.GetProgramParameter(this.program, webgl.LINK_STATUS); if (r3.As <bool>() == false) { alert(webgl.GetProgramInfoLog(this.program)); } //绑定vbo和shader顶点格式,这部分应该要区分材质改变与参数改变,可以少切换一些状态 this.posPos = webgl.GetAttribLocation(this.program, "position"); this.posColor = webgl.GetAttribLocation(this.program, "color"); this.posColor2 = webgl.GetAttribLocation(this.program, "color2"); this.posUV = webgl.GetAttribLocation(this.program, "uv"); this.uniMatrix = webgl.GetUniformLocation(this.program, "matrix"); this.uniTex0 = webgl.GetUniformLocation(this.program, "tex0"); this.uniTex1 = webgl.GetUniformLocation(this.program, "tex1"); this.uniCol0 = webgl.GetUniformLocation(this.program, "col0"); this.uniCol1 = webgl.GetUniformLocation(this.program, "col1"); }
public void compileShader(WebGLShader shader) { #if _DEBUG Log.Info(string.Format("compileShader {0}", shader.Value)); #endif #if GLEW_STATIC Gl.glCompileShader(shader.Value); #else Gl.__glewCompileShader(shader.Value); #endif this.ErrorTest(); }
public void attachShader(WebGLProgram program, WebGLShader shader) { #if _DEBUG Log.Info(string.Format("attachShader {0} {1}", program.Value, shader.Value)); #endif #if GLEW_STATIC Gl.glAttachShader(program.Value, shader.Value); #else Gl.__glewAttachShader(program.Value, shader.Value); #endif this.ErrorTest(); }
public void deleteShader(WebGLShader shader) { #if _DEBUG Log.Info(string.Format("deleteShader", shader.Value)); #endif #if GLEW_STATIC Gl.glDeleteShader(shader.Value); #else Gl.__glewDeleteShader(shader.Value); #endif this.ErrorTest(); }
private void CompileShader(WebGLShader shader, string source) { // Populate the shader and compile it GL.shaderSource(shader, source); GL.compileShader(shader); // Check for shader compile errors bool status = (bool)GL.getShaderParameter(shader, COMPILE_STATUS); if (!status) { throw new CKGLException("Shader compile error: " + GL.getShaderInfoLog(shader)); } }
protected void InitializeShaders(string vertexShaderCode, string fragmentShaderCode) { vertexShader = gl.CreateShader(gl.VertexShader); gl.ShaderSource(vertexShader, vertexShaderCode); gl.CompileShader(vertexShader); fragmentShader = gl.CreateShader(gl.FragmentShader); gl.ShaderSource(fragmentShader, fragmentShaderCode); gl.CompileShader(fragmentShader); shaderProgram = gl.CreateProgram(); gl.AttachShader(shaderProgram, vertexShader); gl.AttachShader(shaderProgram, fragmentShader); gl.LinkProgram(shaderProgram); gl.UseProgram(shaderProgram); }
private static async Task <WebGLShader> CreateShader(ShaderType type, string source) { WebGLShader shader = await GL.CreateShaderAsync(type); await GL.ShaderSourceAsync(shader, source); await GL.CompileShaderAsync(shader); bool success = await GL.GetShaderParameterAsync <bool>(shader, ShaderParameter.COMPILE_STATUS); if (success) { return(shader); } Console.WriteLine(await GL.GetShaderInfoLogAsync(shader)); await GL.DeleteShaderAsync(shader); return(null); }
private static async Task <WebGLProgram> createProgram(WebGLShader vertexShader, WebGLShader fragmentShader) { WebGLProgram program = await GL.CreateProgramAsync(); await GL.AttachShaderAsync(program, vertexShader); await GL.AttachShaderAsync(program, fragmentShader); await GL.LinkProgramAsync(program); bool success = await GL.GetProgramParameterAsync <bool>(program, ProgramParameter.LINK_STATUS); if (success) { return(program); } Console.WriteLine(await GL.GetProgramInfoLogAsync(program)); //await GL.DeleteProgramAsync(program); return(null); }
WebGLProgram CreateShaderProgram(WebGLRenderingContext gl, WebGLShader vertShader, WebGLShader fragShader) { var prog = gl.CreateProgram().As <WebGLProgram>(); gl.AttachShader(prog, vertShader); gl.AttachShader(prog, fragShader); gl.LinkProgram(prog); var status = gl.GetProgramParameter(prog, gl.LINK_STATUS); if (status.As <bool>()) { return(prog); } var info = gl.GetProgramInfoLog(prog); gl.DeleteProgram(prog); throw new InvalidOperationException($"Unable to link program. Details: {info}"); }
public object getShaderParameter(WebGLShader shader, int pname) { #if _DEBUG Log.Info(string.Format("getShaderParameter {0} {1}", shader.Value, pname)); #endif int i; unsafe { #if GLEW_STATIC Gl.glGetShaderiv(shader.Value, pname, &i); #else Gl.__glewGetShaderiv(shader.Value, pname, &i); #endif } this.ErrorTest(); #if _DEBUG Log.Info(string.Format("value {0}", i)); #endif return(i); }
public string getShaderInfoLog(WebGLShader shader) { #if _DEBUG Log.Info("getShaderInfoLog"); #endif var GL_INFO_LOG_LENGTH = 35716; //var GL_SHADING_LANGUAGE_VERSION = 35724; int k; unsafe { #if GLEW_STATIC Gl.glGetShaderiv(shader.Value, GL_INFO_LOG_LENGTH, &k); #else Gl.__glewGetShaderiv(shader.Value, GL_INFO_LOG_LENGTH, &k); #endif } if (k <= 0) { return(string.Empty); } var result = new byte[k]; unsafe { fixed(byte *presult = &result[0]) { #if GLEW_STATIC Gl.glGetShaderInfoLog(shader.Value, k, &k, presult); #else Gl.__glewGetShaderInfoLog(shader.Value, k, &k, presult); #endif } } ////var version = glGetString(GL_SHADING_LANGUAGE_VERSION); return(new string(Encoding.ASCII.GetChars(result))); }
private WebGLShader LoadShader(uint shaderType, string shaderSource) { // Create the shader object WebGLShader shader = gl.CreateShader(shaderType); if (shader == null) { throw new Exception("RuntimeException:"); } // Load the shader source gl.ShaderSource(shader, shaderSource); // Compile the shader gl.CompileShader(shader); // Check the compile status bool compiled = (bool)gl.GetShaderParameter(shader, GLES20.COMPILE_STATUS); if (!compiled) { // Something went wrong during compilation; get the error throw new Exception("RuntimeException: Shader compile error: " + gl.GetShaderInfoLog(shader)); } return(shader); }
public string getShaderInfoLog(WebGLShader shader) { var GL_INFO_LOG_LENGTH = 35716U; var GL_SHADING_LANGUAGE_VERSION = 35724U; var k = new int[1]; this.openGl.GetShader(shader.Value, GL_INFO_LOG_LENGTH, k); if (k[0] == -1) { return(string.Empty); } if (k[0] == 0) { return(string.Empty); } var result = new StringBuilder(); result.Capacity = k[0]; unsafe { fixed(void *p = k) { this.openGl.GetShaderInfoLog(shader.Value, k[0], new IntPtr(p), result); } } var version = this.openGl.GetString(GL_SHADING_LANGUAGE_VERSION); result.AppendFormat("GL VERSION: {0}", version); this.ErrorTest(); return(result.ToString()); }
public JsString getShaderSource(WebGLShader shader) { return(default(JsString)); }
public void detachShader(WebGLProgram program, WebGLShader shader) { }
public JsString getShaderInfoLog(WebGLShader shader) { return(default(JsString)); }
public void compileShader(WebGLShader shader) { }
public void deleteShader(WebGLShader shader) { }
public void shaderSource(WebGLShader shader, string @string) {}
public JsString GetTranslatedShaderSource(WebGLShader shader) { return default(JsString); }
public void ShaderSource(WebGLShader shader, JsString @JsString) { }
public static void Init(RenderContext renderContext) { GL gl = renderContext.gl; String fragShaderText = " precision highp float; \n" + " uniform vec4 lineColor; \n" + " varying lowp vec4 vColor; \n" + " void main(void) \n" + " { \n" + " gl_FragColor = lineColor * vColor; \n" + " } \n"; String vertexShaderText = " attribute vec3 aVertexPosition; \n" + " attribute vec4 aVertexColor; \n" + " attribute vec2 aTime; \n" + " uniform mat4 uMVMatrix; \n" + " uniform mat4 uPMatrix; \n" + " uniform float jNow; \n" + " uniform float decay; \n" + " \n" + " varying lowp vec4 vColor; \n" + " \n" + " void main(void) \n" + " { \n" + " gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); \n" + " float dAlpha = 1.0; \n" + " if ( decay > 0.0) \n" + " { \n" + " dAlpha = 1.0 - ((jNow - aTime.y) / decay); \n " + " if (dAlpha > 1.0 ) \n" + " { \n" + " dAlpha = 1.0; \n" + " } \n" + " } \n" + " if (jNow < aTime.x && decay > 0.0) \n" + " { \n" + //" vColor = vec4(0.0, 0.0, 0.0, 0.0); \n" + " vColor = vec4(1, 1, 1, 1); \n" + " } \n" + " else \n" + " { \n" + " vColor = vec4(aVertexColor.r, aVertexColor.g, aVertexColor.b, dAlpha * aVertexColor.a); \n" + //" vColor = vec4(1, 1, 1, 1); \n" + " } \n" + " } \n" + " \n"; frag = gl.createShader(GL.FRAGMENT_SHADER); gl.shaderSource(frag, fragShaderText); gl.compileShader(frag); object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS); vert = gl.createShader(GL.VERTEX_SHADER); gl.shaderSource(vert, vertexShaderText); gl.compileShader(vert); object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS); prog = gl.createProgram(); gl.attachShader(prog, vert); gl.attachShader(prog, frag); gl.linkProgram(prog); object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS); gl.useProgram(prog); vertLoc = gl.getAttribLocation(prog, "aVertexPosition"); colorLoc = gl.getAttribLocation(prog, "aVertexColor"); timeLoc = gl.getAttribLocation(prog, "aTime"); lineColorLoc = gl.getUniformLocation(prog, "lineColor"); projMatLoc = gl.getUniformLocation(prog, "uPMatrix"); mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix"); jNowLoc = gl.getUniformLocation(prog, "jNow"); decayLoc = gl.getUniformLocation(prog, "decay"); gl.enable(GL.BLEND); gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA); initialized = true; }
public bool isShader(WebGLShader shader) { return default(bool); }
public bool isShader(WebGLShader shader) { return(default(bool)); }
public JsString getShaderInfoLog(WebGLShader shader) { return default(JsString); }
public void detachShader(WebGLProgram program, WebGLShader shader) { }
public void compileShader(WebGLShader shader) { }
public static void Init(RenderContext renderContext) { GL gl = renderContext.gl; String fragShaderText = " precision mediump float; \n" + " uniform vec4 lineColor; \n" + " varying lowp vec4 vColor; \n" + " uniform sampler2D uSampler; \n" + " void main(void) \n" + " { \n" + " vec4 texColor; \n" + " texColor = texture2D(uSampler, gl_PointCoord); \n" + " \n" + " \n" + " gl_FragColor = lineColor * vColor * texColor; \n" + " } \n"; String vertexShaderText = " attribute vec3 aVertexPosition; \n" + " attribute vec4 aVertexColor; \n" + " attribute vec2 aTime; \n" + " attribute float aPointSize; \n" + " uniform mat4 uMVMatrix; \n" + " uniform mat4 uPMatrix; \n" + " uniform float jNow; \n" + " uniform vec3 cameraPosition; \n" + " uniform float decay; \n" + " uniform float scale; \n" + " \n" + " varying lowp vec4 vColor; \n" + " \n" + " void main(void) \n" + " { \n" + " float dist = distance(aVertexPosition, cameraPosition); \n" + " gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); \n" + " float dAlpha = 1.0; \n" + " if ( decay > 0.0) \n" + " { \n" + " dAlpha = 1.0 - ((jNow - aTime.y) / decay); \n " + " if (dAlpha > 1.0 ) \n" + " { \n" + " dAlpha = 1.0; \n" + " } \n" + " } \n" + " if (jNow < aTime.x && decay > 0.0) \n" + " { \n" + " vColor = vec4(0.0, 0.0, 0.0, 0.0); \n" + " } \n" + " else \n" + " { \n" + // " vColor = vec4(aVertexColor.r, aVertexColor.g, aVertexColor.b, dAlpha); \n" + " vColor = vec4(1,1,1,1); \n" + " } \n" + " gl_PointSize = max(1.0, (scale * ( aPointSize ) / dist)); \n" + " } \n" + " \n"; frag = gl.createShader(GL.FRAGMENT_SHADER); gl.shaderSource(frag, fragShaderText); gl.compileShader(frag); object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS); vert = gl.createShader(GL.VERTEX_SHADER); gl.shaderSource(vert, vertexShaderText); gl.compileShader(vert); object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS); object compilationLog = gl.getShaderInfoLog(vert); prog = gl.createProgram(); gl.attachShader(prog, vert); gl.attachShader(prog, frag); gl.linkProgram(prog); object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS); gl.useProgram(prog); vertLoc = gl.getAttribLocation(prog, "aVertexPosition"); colorLoc = gl.getAttribLocation(prog, "aVertexColor"); pointSizeLoc = gl.getAttribLocation(prog, "aPointSize"); timeLoc = gl.getAttribLocation(prog, "aTime"); projMatLoc = gl.getUniformLocation(prog, "uPMatrix"); mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix"); sampLoc = gl.getUniformLocation(prog, "uSampler"); jNowLoc = gl.getUniformLocation(prog, "jNow"); decayLoc = gl.getUniformLocation(prog, "decay"); lineColorLoc = gl.getUniformLocation(prog, "lineColor"); cameraPosLoc = gl.getUniformLocation(prog, "cameraPosition"); scaleLoc = gl.getUniformLocation(prog, "scale"); gl.enable(GL.BLEND); initialized = true; }
public object GetShaderParameter(WebGLShader shader, int pname) { return null; }
public void shaderSource(WebGLShader shader, string @string) { }
/// <summary> /// Deletes a specific shader object. /// If shader is attached to a program object, it's flagged for deletion until it's no longer attached to the object. A shader needs to be detached with detachShader before it can be deleted. /// /// Errors: /// gl.INVALID_VALUE If the shader isn't generated by WebGL. /// </summary> /// <param name="shader">The shader to delete</param> public virtual void DeleteShader(WebGLShader shader) { }
public virtual object GetShaderParameter(WebGLShader shader, uint pname) { return null; }
/// <summary> /// Detach a shader object from a program object. /// If the shader is flagged for deletion by deleteShader, it's deleted after it's removed. /// </summary> /// <param name="program">The program object that contains the shader to detach. </param> /// <param name="shader">The shader to detach.</param> public virtual void DetachShader(WebGLProgram program, WebGLShader shader) { }
public void ShaderSource(WebGLShader shader, string source) => this.CallMethod <object>(SHADER_SOURCE, shader, source);
/// <summary> /// Returns errors which occur when compiling a shader. /// Shader compilation errors are written to the shader's info log. /// To get compile status, call gl.getShaderParameter(myShader,gl.COMPILE_STATUS) to check for a failed compile. On a failed compile, call gl.getShaderInfoLog(myShader) to get the error information. This method only returns the info log, but doesn't clear the log like getError does. /// </summary> /// <param name="shader">The shader object.</param> /// <returns>The information log.</returns> public virtual string GetShaderInfoLog(WebGLShader shader) { return null; }
public static void Init(RenderContext renderContext) { GL gl = renderContext.gl; String fragShaderText = " precision mediump float; \n" + " \n" + " varying vec2 vTextureCoord; \n" + " \n" + " uniform sampler2D uSampler; \n" + " \n" + " void main(void) { \n" + " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t)); \n" + " } \n"; String vertexShaderText = " attribute vec3 aVertexPosition; \n" + " attribute vec2 aTextureCoord; \n" + " \n" + " uniform mat4 uMVMatrix; \n" + " uniform mat4 uPMatrix; \n" + " \n" + " varying vec2 vTextureCoord; \n" + " \n" + " \n" + " void main(void) { \n" + " gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); \n" + " vTextureCoord = aTextureCoord; \n" + " } \n" + " \n"; frag = gl.createShader(GL.FRAGMENT_SHADER); gl.shaderSource(frag, fragShaderText); gl.compileShader(frag); object stat = gl.getShaderParameter(frag, GL.COMPILE_STATUS); vert = gl.createShader(GL.VERTEX_SHADER); gl.shaderSource(vert, vertexShaderText); gl.compileShader(vert); object stat1 = gl.getShaderParameter(vert, GL.COMPILE_STATUS); prog = gl.createProgram(); gl.attachShader(prog, vert); gl.attachShader(prog, frag); gl.linkProgram(prog); object errcode = gl.getProgramParameter(prog, GL.LINK_STATUS); gl.useProgram(prog); vertLoc = gl.getAttribLocation(prog, "aVertexPosition"); textureLoc = gl.getAttribLocation(prog, "aTextureCoord"); projMatLoc = gl.getUniformLocation(prog, "uPMatrix"); mvMatLoc = gl.getUniformLocation(prog, "uMVMatrix"); sampLoc = gl.getUniformLocation(prog, "uSampler"); Tile.uvMultiple = 1; Tile.DemEnabled = true; gl.enable(GL.BLEND); gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA); initialized = true; }
/// <summary> /// Returns the value of the parameter associated with pname for a shader object. /// </summary> /// <param name="shader">The shader object to query. </param> /// <param name="pName">The parameter to look up. /// Parameter Returned type /// /// gl.SHADER_TYPE Number /// gl.DELETE_STATUS Boolean /// gl.COMPILE_STATUS Boolean /// </param> /// <returns>Value of pname.</returns> public virtual Any<int, bool, object> GetShaderParameter(WebGLShader shader, int pName) { return null; }
public void deleteShader(WebGLShader shader) { }
/// <summary> /// Returns source code string associated with a shader object. /// /// Errors: /// gl.INVALID_VALUE If shader is not valid. /// gl.INVALID_OPERATION If shader is not a shader object. /// </summary> /// <param name="shader">The shader object to query.</param> /// <returns>The shader source code string. Returns null if an error occurred. </returns> public virtual string GetShaderSource(WebGLShader shader) { return null; }
public object getShaderParameter(WebGLShader shader, int pname) { return default(object); }
/// <summary> /// Gets state of WebGL shader. Returns true if shader is valid, false otherwise. /// </summary> /// <param name="shader">Shader to query.</param> /// <returns>Returns true if shader is valid, false otherwise. </returns> public virtual bool IsShader(WebGLShader shader) { return false; }
public JsString getShaderSource(WebGLShader shader) { return default(JsString); }
/// <summary> /// Sets and replaces shader source code in a shader object. /// /// Errors: /// gl.INVALID_VALUE If shader isn't a WebGL object or value. /// gl.INVALID_OPERATION If shader isn't a WebGLShader object. /// </summary> /// <param name="shader">The shader object to set the source code on. </param> /// <param name="source">GLSL source code.</param> public virtual void ShaderSource(WebGLShader shader, string source) { }
public void shaderSource(WebGLShader shader, string source) { }
/// <summary> /// Compiles the GLSL shader source into binary data used by the WebGLProgram object. /// /// When compiling shader source code, call getShaderParameter to get the status. getShaderParameter returns true if the source compiled successfully, or false if compilation failed. On failure, call getShaderInfoLog for the shader compiler's log. Errors are contained in the log. /// /// Errors: /// gl.INVALID_VALUE The shader isn't a WebGLShader object. /// The shader is not generated by WebGL. /// /// gl.INVALID_OPERATION The shader compiler isn't supported. /// </summary> /// <param name="shader">An object that represents source code strings. </param> public virtual void CompileShader(WebGLShader shader) { }