Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports OpenTK
- Imports OpenTK.Graphics
- Imports OpenTK.Graphics.OpenGL
- Public Class Form1
- Private Sub GL_Load(sender As Object, e As System.EventArgs) Handles GlControl1.Load
- GL.ClearColor(Color.Black)
- GL.MatrixMode(MatrixMode.Projection)
- GL.LoadIdentity()
- GL.Ortho(0, GlControl1.Width, GlControl1.Height, 0, 1, -1)
- GL.MatrixMode(MatrixMode.Modelview)
- End Sub
- Private Sub GlControl1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles GlControl1.Paint
- GL.Clear(ClearBufferMask.ColorBufferBit)
- GL.LoadIdentity()
- GL.Begin(BeginMode.Polygon)
- GL.Color3(255, 0, 0)
- GL.Vertex2(0, 5)
- GL.Vertex2(5, -5)
- GL.Vertex2(-5, -5)
- GL.End()
- GL.Begin(BeginMode.Lines)
- GL.Color3(0, 255, 0)
- GL.Vertex2(50, 50)
- GL.Vertex2(100, 100)
- GL.End()
- GL.Flush()
- GraphicsContext.CurrentContext.VSync = True 'Caps frame rate as to not over run GPU
- GlControl1.SwapBuffers() 'Takes from the 'GL' and puts into control
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement