コード例 #1
0
ファイル: Form1.cs プロジェクト: dgurchin/StudyData
        private void button1_Click(object sender, EventArgs e)
        {
            GL.Viewport(0, 0, Width, Height);
            Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)System.Math.PI / 4, glControl1.Width / (float)Height, 1.0f, 64.0f);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref modelview);

            GL.Begin(BeginMode.Triangles);

            GL.Color3(1.0f, 1.0f, 0.0f); GL.Vertex3(-1.0f, -1.0f, 4.0f);
            GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.0f, -1.0f, 4.0f);
            GL.Color3(0.2f, 0.9f, 1.0f); GL.Vertex3(0.0f, 1.0f, 4.0f);

            GL.End();

            glControl1.SwapBuffers();
        }
コード例 #2
0
 public static void Viewport(System.Drawing.Point location, System.Drawing.Size size)
 {
     GL.Viewport(location.X, location.Y, size.Width, size.Height);
 }
コード例 #3
0
 public static void Viewport(System.Drawing.Rectangle rectangle)
 {
     GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
 }
コード例 #4
0
 public static void Viewport(System.Drawing.Size size)
 {
     GL.Viewport(0, 0, size.Width, size.Height);
 }