Search code examples
c#linuxmonoopentk

ClientSize not updating GameWindow Width and Height in C# on Linux


I have the following method that takes care of setting the size of the window when it has loaded (This all happens in a the class MyClass that's a subclass of GameWindow).

protected override void OnLoad( EventArgs e )
{
    // called during application initialization
    GL.ClearColor( 0, 0, 0, 0 );
    GL.Enable( EnableCap.Texture2D );
    GL.Disable( EnableCap.DepthTest );
    GL.Hint( HintTarget.PerspectiveCorrectionHint, HintMode.Nicest );
    Console.WriteLine(Width.ToString() + " " + Height.ToString()); // 640, 480
    ClientSize = new Size( 640, 400 );
    app = new MyApplication();
    Console.WriteLine(Width.ToString() + " " + Height.ToString()); // 640, 480
    app.screen = new Surface( Width, Height );
    Sprite.target = app.screen;
    screenID = app.screen.GenTexture();
    app.Init();
}

I have a problem with ClientSize as it seems to take the inputted values as a suggestion. No matter what I put into it, the Width and Height always stay 640 and 400 respectively. I expect it to change those values. I checked with a friend who runs Windows and for him it works like expected. I'm running Linux and feel the problem is related to that, although I'm not sure. I'm using Mono to compile. And I've already looked at a couple of things:

There's this bug report that looks like it might be talking about my problem: https://github.com/opentk/opentk/issues/259 but the bug has been fixed and I use a resizable and not a fixed window.

Can somebody help me out? Any and all help will be gladly appreciated.


Solution

  • There is no solution to this one and I've opened an issue. Look there for further help if you also have problems with this:

    https://github.com/opentk/opentk/issues/1053

    When OpenTK updates to version 4.0 it should probably be fixed, but that version is still in beta.