49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using OpenTK.Graphics.OpenGL4;
|
|
using OpenTK.Windowing.Common;
|
|
using OpenTK.Windowing.Desktop;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Voxel
|
|
{
|
|
public class Window(int width, int height, string title) : GameWindow(GameWindowSettings.Default, new NativeWindowSettings() { Size = (width, height), Title = title })
|
|
{
|
|
private Triangle _triangle;
|
|
|
|
protected override void OnUpdateFrame(FrameEventArgs args)
|
|
{
|
|
base.OnUpdateFrame(args);
|
|
}
|
|
|
|
protected override void OnRenderFrame(FrameEventArgs args)
|
|
{
|
|
base.OnRenderFrame(args);
|
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
|
|
|
_triangle.Draw();
|
|
|
|
SwapBuffers();
|
|
}
|
|
|
|
protected override void OnFramebufferResize(FramebufferResizeEventArgs e)
|
|
{
|
|
base.OnFramebufferResize(e);
|
|
|
|
GL.Viewport(0, 0, e.Width, e.Height);
|
|
}
|
|
|
|
protected override void OnLoad()
|
|
{
|
|
base.OnLoad();
|
|
|
|
_triangle = new Triangle();
|
|
|
|
GL.ClearColor(0.5f, 0.5f, 0.5f, 1f);
|
|
}
|
|
}
|
|
}
|