-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.cs
50 lines (45 loc) · 1.26 KB
/
MainWindow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using OpenToolkit;
using OpenToolkit.Graphics.OpenGL4;
using OpenToolkit.Mathematics;
using OpenToolkit.Windowing.Desktop;
using System;
using System.Diagnostics;
namespace opentoolkit_dummy
{
public class MainWindow : GameWindow
{
public MainWindow() : base(GameWindowSettings.Default, NativeWindowSettings.Default)
{
Debug.WriteLine(this.Size);
this.Size = new Vector2i(1600, 800);
Debug.WriteLine(this.Size.X + ": " + this.Size.Y);
}
protected override void OnLoad()
{
//this.Size = new Vector2i(1600, 800);
GL.Viewport(0,0,Size.X, Size.Y);
Closed += OnClosed;
}
protected override void OnRenderFrame(OpenToolkit.Windowing.Common.FrameEventArgs args)
{
GL.ClearColor(Color4.Crimson);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
SwapBuffers();
}
protected override void OnResize(OpenToolkit.Windowing.Common.ResizeEventArgs e)
{
//base OnResize fixed the issue
base.OnResize(e);
GL.Viewport(0,0,Size.X, Size.Y);
Debug.WriteLine(Size.X + ": " + Size.Y);
}
private void OnClosed(object sender, System.EventArgs e)
{
Close();
}
public override void Close()
{
base.Close();
}
}
}