sdchown's picture

VB .NET Help. Can't get OpenTK to do anything.

Hi

I have installed it all and followed the VB .NET example, but all I get is a blank window. No colour, no nothing.

Any help? Any ideas?

Code below:

Imports System.Drawing
Imports System
Imports OpenTK
Imports OpenTK.Graphics.OpenGL
 
Public Class Mainform
 
 
    Dim loaded As Boolean = False
 
 
    Private Sub Mainform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeComponent()
 
    End Sub
 
    Private Sub GlControl1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles GlControl1.KeyDown
        If e.KeyValue = Keys.Escape Then
            Application.Exit()
        Else
            GlControl1.Invalidate()
        End If
 
    End Sub
 
 
 
 
    Private Sub GlControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GlControl1.Load
        loaded = True
        GlControl1_Resize(sender, EventArgs.Empty)
 
        GL.ClearColor(Color.ForestGreen)
 
    End Sub
 
    Private Sub GlControl1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GlControl1.Paint
        If Not loaded Then Exit Sub
        GL.Clear(ClearBufferMask.ColorBufferBit)
        GlControl1.MakeCurrent()
 
        GlControl1.SwapBuffers()
 
    End Sub
 
    Private Sub GlControl1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles GlControl1.Resize
        If Not loaded Then Exit Sub
        If GlControl1.ClientSize.Height = 0 Then GlControl1.ClientSize = New System.Drawing.Size(GlControl1.ClientSize.Width, 1)
 
        GL.Viewport(0, 0, GlControl1.ClientSize.Width, GlControl1.ClientSize.Height)
 
    End Sub
End Class

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

Not really, the problem is if I reward you with the solution after you spammed so hard that you break your caps lock key ....... then this will be continued, because it has proven to work. Maybe not by you, but by others seeing that it works.

darkdave's picture

Fine, i'm jumping out my window.

Inertia's picture

Guess the window was at the ground floor :P I've actually deleted all his posts that were in the wrong topic and left only the post in the right topic here. (OpenTK.Compatibility.dll is for Tao/Glu old and deprecated stuff)