本文整理汇总了C#中Byte4.ToUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# Byte4.ToUInt32方法的具体用法?C# Byte4.ToUInt32怎么用?C# Byte4.ToUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Byte4
的用法示例。
在下文中一共展示了Byte4.ToUInt32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRenderFrame
/// <summary>
/// Called when it is time to render the next frame. Add your rendering code here.
/// </summary>
/// <param name="e">Contains timing information.</param>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Color3(Color.White);
GL.Enable(EnableCap.ColorArray);
#region Pass 1: Draw Object and pick Triangle
GL.ClearColor(1f, 1f, 1f, 1f); // clears to uint.MaxValue
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 modelview = Matrix4.LookAt(Vector3.UnitZ, Vector3.Zero, Vector3.UnitY);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadMatrix(ref modelview);
GL.Translate(0f, 0f, -3f);
GL.Rotate(angle, Vector3.UnitX);
GL.Rotate(angle, Vector3.UnitY);
angle += (float)e.Time * 3.0f;
// You may re-enable the shader, but it works perfectly without and will run on intel HW too
// GL.UseProgram(ProgramObject);
GL.DrawArrays(VBO_PrimMode, 0, VBO_Array.Length);
// GL.UseProgram(0);
// Read Pixel under mouse cursor
Byte4 Pixel = new Byte4();
GL.ReadPixels(Mouse.X, this.Height - Mouse.Y, 1, 1, PixelFormat.Rgba, PixelType.UnsignedByte, ref Pixel);
SelectedTriangle = Pixel.ToUInt32();
#endregion Pass 1: Draw Object and pick Triangle
GL.Color3(Color.White);
GL.Disable(EnableCap.ColorArray);
#region Pass 2: Draw Shape
if (SelectedTriangle == uint.MaxValue)
GL.ClearColor(.2f, .1f, .3f, 1f); // purple
else
GL.ClearColor(0f, .2f, .3f, 1f); // cyan
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.Color3(1f, 1f, 1f);
GL.DrawArrays(VBO_PrimMode, 0, VBO_Array.Length);
GL.PolygonMode(MaterialFace.Front, PolygonMode.Line);
GL.Color3(Color.Red);
GL.DrawArrays(VBO_PrimMode, 0, VBO_Array.Length);
GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);
if (SelectedTriangle != uint.MaxValue)
{
GL.Disable(EnableCap.DepthTest);
GL.Color3(Color.Green);
GL.DrawArrays(VBO_PrimMode, (int)SelectedTriangle * 3, 3);
GL.Enable(EnableCap.DepthTest);
}
#endregion Pass 2: Draw Shape
this.SwapBuffers();
ErrorCode err = GL.GetError();
if (err != ErrorCode.NoError)
Trace.WriteLine("Error at Swapbuffers: " + err);
}