本文整理汇总了C#中IDefault.With方法的典型用法代码示例。如果您正苦于以下问题:C# IDefault.With方法的具体用法?C# IDefault.With怎么用?C# IDefault.With使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDefault
的用法示例。
在下文中一共展示了IDefault.With方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeContent
//.........这里部分代码省略.........
#region canvas
var canvas = new IHTMLCanvas().AttachToDocument();
Native.Document.body.style.overflow = IStyle.OverflowEnum.hidden;
canvas.style.SetLocation(0, 0, size, size);
canvas.width = size;
canvas.height = size;
#endregion
#region gl - Initialise WebGL
var gl = default(WebGLRenderingContext);
try
{
gl = (WebGLRenderingContext)canvas.getContext("experimental-webgl");
}
catch { }
if (gl == null)
{
Native.window.alert("WebGL not supported");
throw new InvalidOperationException("cannot create webgl context");
}
#endregion
#region drawingMode
var drawingMode = gl.TRIANGLES;
page.With(
delegate
{
page.triangles.onchange +=
delegate
{
if (drawingMode == gl.TRIANGLES)
drawingMode = gl.LINE_STRIP;
else
drawingMode = gl.TRIANGLES;
};
}
);
#endregion
var shaderProgram = gl.createProgram(
new TunnelVertexShader(),
new TunnelFragmentShader()
);
// "WebGL: INVALID_OPERATION: drawElements: attribs not setup correctly", source: http://192.168.43.252:16876/ (0)
// I/chromium( 3770): [INFO:CONSOLE(0)] "WebGL: INVALID_OPERATION: useProgram: program not valid", source: http://192.168.43.252:16876/ (0)
gl.linkProgram(shaderProgram);
gl.useProgram(shaderProgram);
var shaderProgram_vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition");
gl.enableVertexAttribArray((uint)shaderProgram_vertexPositionAttribute);