add platformer window infrastructure

This commit is contained in:
2018-04-08 20:29:20 -04:00
parent edb2985a98
commit f175dd84f4
12 changed files with 328 additions and 0 deletions

20
Platformer/Util/Buffer.cs Normal file
View File

@@ -0,0 +1,20 @@
using System;
using System.Runtime.InteropServices;
using OpenTK.Graphics.OpenGL4;
namespace Platformer.Util
{
public class Buffer : GlObj
{
public Buffer() : base(GL.GenBuffer())
{
}
public void SetData<T>(T[] data, BufferUsageHint usage = BufferUsageHint.StaticDraw) where T : struct
{
GL.BindBuffer(BufferTarget.ArrayBuffer, this);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(data.Length * Marshal.SizeOf(typeof(T))), data, usage);
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
}
}
}