简体   繁体   中英

OpenTK GameWindow “laggy”

I tried to create a new GameWindow in VB.NET using the OpenTK library.

The game window works fine, I can maximize it or change its size perfectly fine, but it takes a few seconds for the window to appear in the taskbar and it's very laggy when I right-click it in the taskbar.

I tried

  • changing the update/render time to 1 update per second which doesn't change anything
  • starting the GameWindow in a seperate thread
  • not to use ILMerge. Doesn't change anything.

Source Code

Module Main ( Entry point )

Imports OpenTK
Imports System.Threading

Module Main

    Public Sub Main()
        Dim MainGameWindow As New MyGameWindow
        MainGameWindow.Run(30, 60) 'Tried changing this to MainGameWindow.Run(1, 1)
    End Sub

End Module

Class MyGameWindow ( GameWindow )

Imports OpenTK
Imports OpenTK.Graphics
Imports OpenTK.Graphics.OpenGL

Public Class MyGameWindow
    Inherits GameWindow

    Private GlLoaded As Boolean = False

    Public Sub New()
        MyBase.New(820, 520)
        Title = "Game Test"
        Icon = My.Resources.gameicon
    End Sub

    Private Sub MyGameWindow_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        GlLoaded = True
    End Sub

    Private Sub MyGameWindow_RenderFrame(ByVal sender As Object, ByVal e As OpenTK.FrameEventArgs) Handles Me.RenderFrame
        If Not GlLoaded Then Return

        'Nothing here yet...
    End Sub

    Private Sub MyGameWindow_UpdateFrame(ByVal sender As Object, ByVal e As OpenTK.FrameEventArgs) Handles Me.UpdateFrame
        If Not GlLoaded Then Return

        'Nothing here yet...
    End Sub

    Private Sub MyGameWindow_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        'Nothing here yet...
    End Sub
End Class

Environment

  • Windows 7 Home Premium 64-bit (Service Pack 1)
  • Target framework is set to .NET Framework 2.0 . Changing it to 4.0 doesn't fix the issue.

This was a bug in the way OpenTK 1.0 interacted with keyboard layouts. It has been fixed in OpenTK 1.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM