OpenTK GameWindow" laggy"

时间:2013-06-13 21:50:54

标签: .net vb.net opengl lag opentk

我尝试使用OpenTK库在VB.NET中创建一个新的GameWindow。

游戏窗口工作正常,我可以最大化它或完全改变它的大小,但窗口出现在任务栏需要几秒钟,当我在任务栏中右键单击它时,它非常迟缓。

我试过

  • 将更新/渲染时间更改为每秒1次更新,这不会改变任何内容
  • 以单独的线程启动GameWindow
  • 不使用ILMerge。不会改变任何东西。

源代码

模块主要(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

环境

  • Windows 7家庭高级版64位(Service Pack 1)
  • 目标框架设置为.NET Framework 2.0。将其更改为4.0无法解决问题。

1 个答案:

答案 0 :(得分:1)

这是OpenTK 1.0与键盘布局交互方式的一个错误。它已在OpenTK 1.1中修复。