Simple renderer in .net with SharpGL (openGL)

Re: Simple renderer in .net with openTK (openGL)
For example:

Private Sub GlControl1_Load(sender As Object, e As System.EventArgs) Handles GlControl1.Load
        glLoaded = True
        GL.ClearColor(Color.SkyBlue) ' .NET Colors can be used directly!
End Sub
Private Sub SetupViewport()
        Dim w As Integer = GlControl1.Width
        Dim h As Integer = GlControl1.Height
        GL.Ortho(0, w, 0, h, -1, 1) ' // Bottom-left corner pixel has coordinate (0, 0)
        GL.Viewport(0, 0, w, h) ' // Use all of the glControl painting area
End Sub
Public Sub GlControl1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles GlControl1.Paint
        If Not glLoaded Then Exit Sub

        GL.Clear(ClearBufferMask.ColorBufferBit Or ClearBufferMask.DepthBufferBit)


        GL.Vertex2(10, 20)
        GL.Vertex2(100, 20)
        GL.Vertex2(100, 50)

End Sub

This is the code that currently works.
« Next Oldest | Next Newest »

Messages In This Thread
Re: Simple renderer in .net with openTK (openGL) - by Michael Heidemann - 2013-11-30, 15:48

Forum Jump:

Users browsing this thread: 1 Guest(s)