本文整理汇总了C#中WebGLRenderingContext.deleteShader方法的典型用法代码示例。如果您正苦于以下问题:C# WebGLRenderingContext.deleteShader方法的具体用法?C# WebGLRenderingContext.deleteShader怎么用?C# WebGLRenderingContext.deleteShader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebGLRenderingContext
的用法示例。
在下文中一共展示了WebGLRenderingContext.deleteShader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateShader
static CreateShaderResult CreateShader(
WebGLRenderingContext gl,
string tvs,
string tfs,
bool nativeDebug
)
{
//new IHTMLPre { "enter CreateShader" }.AttachToDocument();
//var p = gl.createProgram();
var vs = new WebGLShader(gl, gl.VERTEX_SHADER);
var fs = new WebGLShader(gl, gl.FRAGMENT_SHADER);
gl.shaderSource(vs, tvs);
gl.shaderSource(fs, tfs);
gl.compileShader(vs);
var ok = new CreateShaderResult { mSuccess = true };
// https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_shaders/
new WebGLDebugShaders(gl).With(x => ok.vsTranslatedShaderSource = x.getTranslatedShaderSource(vs));
//gl.getExtension("WEBGL_debug_shaders").With(
//(dynamic WEBGL_debug_shaders) =>
// {
// ok.vsTranslatedShaderSource = WEBGL_debug_shaders.getTranslatedShaderSource((WebGLShader)vs);
// }
//);
gl.compileShader(fs);
// ipad wont have it available
new WebGLDebugShaders(gl).With(x => ok.fsTranslatedShaderSource = x.getTranslatedShaderSource(fs));
//gl.getExtension("WEBGL_debug_shaders").With(
// (dynamic WEBGL_debug_shaders) =>
// {
// ok.fsTranslatedShaderSource = WEBGL_debug_shaders.getTranslatedShaderSource((WebGLShader)fs);
// }
//);
if (gl.getShaderParameter(vs, gl.COMPILE_STATUS) == null)
{
var infoLog = gl.getShaderInfoLog(vs);
// does our async rewriter throw async exceptions yet?
throw new Exception(message: new { infoLog }.ToString());
//new IHTMLPre { "error CreateShader " + new { infoLog } }.AttachToDocument();
//return new CreateShaderResult { mSuccess = false, mInfo = infoLog };
}
var fsCOMPILE_STATUS = (bool)gl.getShaderParameter(fs, gl.COMPILE_STATUS);
//new IHTMLPre { "CreateShader " + new { fsCOMPILE_STATUS } }.AttachToDocument();
if (!fsCOMPILE_STATUS)
{
var infoLog = gl.getShaderInfoLog(fs);
throw new Exception(message: new { infoLog }.ToString());
//new IHTMLPre { "error CreateShader " + new { infoLog } }.AttachToDocument();
//return new CreateShaderResult { mSuccess = false, mInfo = infoLog };
}
var p = new WebGLProgram(gl);
gl.attachShader(p, vs);
gl.attachShader(p, fs);
// using dispose?
gl.deleteShader(vs);
gl.deleteShader(fs);
gl.linkProgram(p);
var linkResult = (bool)gl.getProgramParameter(p, gl.LINK_STATUS);
//new IHTMLPre { "CreateShader " + new { linkResult } }.AttachToDocument();
if (!linkResult)
{
var infoLog = gl.getProgramInfoLog(p);
gl.deleteProgram(p);
throw new Exception(message: new { infoLog }.ToString());
//new IHTMLPre { "error CreateShader " + new { infoLog } }.AttachToDocument();
//return new CreateShaderResult { mSuccess = false, mInfo = infoLog };
}
// https://msdn.microsoft.com/en-us/library/ie/dn302415(v=vs.85).aspx
//new IHTMLPre { "exit CreateShader" }.AttachToDocument();
ok.mProgram = p;
return ok;
}