diff --git a/WhatTheTexture/App.config b/WhatTheTexture/App.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/WhatTheTexture/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WhatTheTexture/OpenTK.dll.config b/WhatTheTexture/OpenTK.dll.config
new file mode 100644
index 0000000..7098d39
--- /dev/null
+++ b/WhatTheTexture/OpenTK.dll.config
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WhatTheTexture/Program.cs b/WhatTheTexture/Program.cs
new file mode 100644
index 0000000..2c615b9
--- /dev/null
+++ b/WhatTheTexture/Program.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using OpenTK;
+using OpenTK.Graphics.OpenGL;
+using PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat;
+
+namespace WhatTheTexture
+{
+ internal class Program : GameWindow
+ {
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ Width = 1920;
+ Height = 1080;
+ X = (DisplayDevice.Default.Width - Width) / 2;
+ Y = (DisplayDevice.Default.Height - Height) / 2;
+
+ GL.Enable(EnableCap.Texture2D);
+
+ var image = new Bitmap("tex.png");
+
+ var texID = GL.GenTexture();
+
+ GL.ActiveTexture(TextureUnit.Texture0);
+ GL.BindTexture(TextureTarget.Texture2D, texID);
+ var bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
+ ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter,
+ (int) TextureMinFilter.Nearest);
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter,
+ (int) TextureMagFilter.Nearest);
+
+ GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bitmapData.Width, bitmapData.Height, 0,
+ PixelFormat.Bgra, PixelType.UnsignedByte, bitmapData.Scan0);
+
+ image.UnlockBits(bitmapData);
+
+ GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
+
+ GL.Viewport(ClientRectangle);
+
+ GL.Begin(PrimitiveType.Triangles);
+
+ GL.TexCoord2(0, 0);
+ GL.Vertex2(-.8, -.8);
+ GL.TexCoord2(1, 0);
+ GL.Vertex2(.8, -.8);
+ GL.TexCoord2(0, 1);
+ GL.Vertex2(-.8, .8);
+
+ GL.TexCoord2(1, 1);
+ GL.Vertex2(.8, .8);
+ GL.TexCoord2(1, 0);
+ GL.Vertex2(.8, -.8);
+ GL.TexCoord2(0, 1);
+ GL.Vertex2(-.8, .8);
+
+ GL.End();
+
+ SwapBuffers();
+ }
+
+ private static void Main(string[] args)
+ {
+ using (var p = new Program())
+ {
+ p.Run();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/WhatTheTexture/Properties/AssemblyInfo.cs b/WhatTheTexture/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1259cde
--- /dev/null
+++ b/WhatTheTexture/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("WhatTheTexture")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("WhatTheTexture")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e7b84735-45aa-439a-a64b-2af248447660")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/WhatTheTexture/WhatTheTexture.csproj b/WhatTheTexture/WhatTheTexture.csproj
new file mode 100644
index 0000000..2368221
--- /dev/null
+++ b/WhatTheTexture/WhatTheTexture.csproj
@@ -0,0 +1,63 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {E7B84735-45AA-439A-A64B-2AF248447660}
+ Exe
+ WhatTheTexture
+ WhatTheTexture
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
\ No newline at end of file
diff --git a/WhatTheTexture/packages.config b/WhatTheTexture/packages.config
new file mode 100644
index 0000000..74325d8
--- /dev/null
+++ b/WhatTheTexture/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/WhatTheTexture/tex.png b/WhatTheTexture/tex.png
new file mode 100644
index 0000000..4b43e1e
Binary files /dev/null and b/WhatTheTexture/tex.png differ
diff --git a/hexworld.sln b/hexworld.sln
new file mode 100644
index 0000000..ded023d
--- /dev/null
+++ b/hexworld.sln
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26127.3
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hexworld", "hexworld\hexworld.csproj", "{AD9ED057-FB47-44CB-8839-22924B409706}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WhatTheTexture", "WhatTheTexture\WhatTheTexture.csproj", "{E7B84735-45AA-439A-A64B-2AF248447660}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AD9ED057-FB47-44CB-8839-22924B409706}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD9ED057-FB47-44CB-8839-22924B409706}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD9ED057-FB47-44CB-8839-22924B409706}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD9ED057-FB47-44CB-8839-22924B409706}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E7B84735-45AA-439A-A64B-2AF248447660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E7B84735-45AA-439A-A64B-2AF248447660}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E7B84735-45AA-439A-A64B-2AF248447660}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E7B84735-45AA-439A-A64B-2AF248447660}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/hexworld/App.config b/hexworld/App.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/hexworld/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hexworld/Cube.cs b/hexworld/Cube.cs
new file mode 100644
index 0000000..6dfbbba
--- /dev/null
+++ b/hexworld/Cube.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using OpenTK;
+
+namespace hexworld
+{
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Cube
+ {
+ public Vector3 Position;
+ public Vector3 Color;
+
+ public Cube(Vector3 position, Vector3 color)
+ {
+ Position = position;
+ Color = color;
+ }
+ }
+}
diff --git a/hexworld/OpenTK.dll.config b/hexworld/OpenTK.dll.config
new file mode 100644
index 0000000..7098d39
--- /dev/null
+++ b/hexworld/OpenTK.dll.config
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hexworld/Program.cs b/hexworld/Program.cs
new file mode 100644
index 0000000..f3ce35c
--- /dev/null
+++ b/hexworld/Program.cs
@@ -0,0 +1,206 @@
+using System;
+using System.IO;
+using OpenTK;
+using OpenTK.Graphics.OpenGL;
+
+namespace hexworld
+{
+ internal class Game : GameWindow
+ {
+ #region Constructors
+
+ public Game()
+ : this(1920, 1080)
+ {
+ }
+
+ public Game(int width, int height)
+ : base(width, height)
+ {
+ Width = width;
+ Height = height;
+ X = (DisplayDevice.Default.Width - Width) / 2;
+ Y = (DisplayDevice.Default.Height - Height) / 2;
+ }
+
+ #endregion
+
+ #region Shaders
+
+ private int _pgmId;
+ private int _vsId;
+ private int _fsId;
+
+ #region Handles
+
+ #endregion
+
+ private void LoadShader(string filename, ShaderType type, int program, out int address)
+ {
+ address = GL.CreateShader(type);
+ using (var sr = new StreamReader(filename))
+ {
+ GL.ShaderSource(address, sr.ReadToEnd());
+ }
+ GL.CompileShader(address);
+ GL.AttachShader(program, address);
+ Console.WriteLine(GL.GetShaderInfoLog(address));
+ }
+
+ #endregion
+
+ #region Buffers
+
+ private int _vboPosition;
+ private int _cubeVbo;
+ private int _ibo;
+
+
+ #endregion
+
+ #region Data
+
+ private float[] _vertdata;
+ private Cube[] _cubes;
+ private int[] _indices;
+
+ private Matrix4 _view;
+ private Matrix4 _projection;
+
+ #endregion
+
+ private void InitProgram()
+ {
+ _pgmId = GL.CreateProgram();
+
+ LoadShader("vs.glsl", ShaderType.VertexShader, _pgmId, out _vsId);
+ LoadShader("fs.glsl", ShaderType.FragmentShader, _pgmId, out _fsId);
+
+ GL.LinkProgram(_pgmId);
+ Console.WriteLine(GL.GetProgramInfoLog(_pgmId));
+
+ GL.GenBuffers(1, out _vboPosition);
+ GL.BindBuffer(BufferTarget.ArrayBuffer, _vboPosition);
+ GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr) (_vertdata.Length * sizeof(float)), _vertdata,
+ BufferUsageHint.StaticDraw);
+ GL.EnableVertexAttribArray(0);
+ GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);
+
+ GL.GenBuffers(1, out _cubeVbo);
+ GL.BindBuffer(BufferTarget.ArrayBuffer, _cubeVbo);
+ GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr) (_cubes.Length * sizeof(float) * 6), _cubes,
+ BufferUsageHint.StaticDraw);
+ GL.EnableVertexAttribArray(1);
+ GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
+ GL.VertexAttribDivisor(1, 1);
+
+ GL.EnableVertexAttribArray(2);
+ GL.VertexAttribPointer(2, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 3 * sizeof(float));
+ GL.VertexAttribDivisor(2, 1);
+
+ GL.GenBuffers(1, out _ibo);
+ GL.BindBuffer(BufferTarget.ElementArrayBuffer, _ibo);
+ GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr) (_indices.Length * sizeof(int)), _indices,
+ BufferUsageHint.StaticDraw);
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+
+ _vertdata = new[]
+ {
+ -.5f, -.5f, -.5f,
+ -.5f, -.5f, .5f,
+ -.5f, .5f, -.5f,
+ -.5f, .5f, .5f,
+ .5f, -.5f, -.5f,
+ .5f, -.5f, .5f,
+ .5f, .5f, -.5f,
+ .5f, .5f, .5f,
+ };
+
+ _indices = new[]
+ {
+ 0, 1, 2, 1, 2, 3,
+ 4, 5, 6, 5, 6, 7,
+ 0, 1, 4, 1, 4, 5,
+ 2, 3, 6, 3, 6, 7,
+ 0, 2, 4, 2, 4, 6,
+ 1, 3, 5, 3, 5, 7
+ };
+
+ _cubes = new[]
+ {
+ new Cube(new Vector3(2, 2, 0), new Vector3(0.9f, 0.1f, 0.1f)),
+ new Cube(new Vector3(2, 1, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(2, 0, 0), new Vector3(0.1f, 0.9f, 0.1f)),
+ new Cube(new Vector3(2, -1, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(2, -2, 0), new Vector3(0.9f, 0.1f, 0.1f)),
+ new Cube(new Vector3(1, 2, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(1, -2, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(0, 2, 0), new Vector3(0.1f, 0.1f, 0.9f)),
+ new Cube(new Vector3(0, -2, 0), new Vector3(0.1f, 0.1f, 0.9f)),
+ new Cube(new Vector3(-1, 2, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(-1, -2, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(-2, 2, 0), new Vector3(0.9f, 0.1f, 0.1f)),
+ new Cube(new Vector3(-2, 1, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(-2, 0, 0), new Vector3(0.1f, 0.9f, 0.1f)),
+ new Cube(new Vector3(-2, -1, 0), new Vector3(0.1f, 0.1f, 0.1f)),
+ new Cube(new Vector3(-2, -2, 0), new Vector3(0.9f, 0.1f, 0.1f)),
+ };
+
+ InitProgram();
+
+ _view = _projection = Matrix4.Identity;
+ }
+
+ protected override void OnRenderFrame(FrameEventArgs e)
+ {
+ base.OnRenderFrame(e);
+ GL.Viewport(ClientRectangle);
+
+ GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
+ GL.Enable(EnableCap.DepthTest);
+
+
+ GL.DrawElementsInstanced(PrimitiveType.Triangles, _indices.Length, DrawElementsType.UnsignedInt, IntPtr.Zero,
+ _cubes.Length);
+
+ GL.Flush();
+ SwapBuffers();
+ }
+
+ protected override void OnUpdateFrame(FrameEventArgs e)
+ {
+ base.OnUpdateFrame(e);
+
+ _view = Matrix4.LookAt(Vector3.Zero, -Vector3.One, Vector3.UnitZ);
+
+ GL.UniformMatrix4(0, false, ref _view);
+ GL.UniformMatrix4(1, false, ref _projection);
+
+ GL.UseProgram(_pgmId);
+
+ GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
+ }
+
+ protected override void OnResize(EventArgs e)
+ {
+ base.OnResize(e);
+
+ float size = 100;
+ _projection = Matrix4.CreateOrthographic(Width / size, Height / size, -50, 50);
+ }
+
+ public static void Main(string[] args)
+ {
+ Game gw;
+ using (gw = new Game())
+ {
+ gw.Run();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/hexworld/Properties/AssemblyInfo.cs b/hexworld/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dad37ab
--- /dev/null
+++ b/hexworld/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("hexworld")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("hexworld")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ad9ed057-fb47-44cb-8839-22924b409706")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/hexworld/fs.glsl b/hexworld/fs.glsl
new file mode 100644
index 0000000..1ba171f
--- /dev/null
+++ b/hexworld/fs.glsl
@@ -0,0 +1,10 @@
+#version 440
+
+in vec4 color;
+out vec4 outputColor;
+
+void
+main()
+{
+ outputColor = color;
+}
\ No newline at end of file
diff --git a/hexworld/hexworld.csproj b/hexworld/hexworld.csproj
new file mode 100644
index 0000000..d2f1510
--- /dev/null
+++ b/hexworld/hexworld.csproj
@@ -0,0 +1,75 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {AD9ED057-FB47-44CB-8839-22924B409706}
+ Exe
+ hexworld
+ hexworld
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+ Always
+
+
+
+
+ Always
+
+
+
+
\ No newline at end of file
diff --git a/hexworld/packages.config b/hexworld/packages.config
new file mode 100644
index 0000000..dfa0316
--- /dev/null
+++ b/hexworld/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/hexworld/tex.png b/hexworld/tex.png
new file mode 100644
index 0000000..75eb357
Binary files /dev/null and b/hexworld/tex.png differ
diff --git a/hexworld/vs.glsl b/hexworld/vs.glsl
new file mode 100644
index 0000000..28d44a7
--- /dev/null
+++ b/hexworld/vs.glsl
@@ -0,0 +1,17 @@
+#version 440
+
+layout (location = 0) in vec3 vPosition;
+layout (location = 1) in vec3 vColor;
+layout (location = 2) in vec3 vOffset;
+
+out vec4 color;
+
+layout (location = 0) uniform mat4 view;
+layout (location = 1) uniform mat4 projection;
+
+void main()
+{
+ vec3 pos = vPosition + vOffset;
+ gl_Position = projection * view * vec4(pos, 1.0);
+ color = vec4( vColor, 1.0);
+}
\ No newline at end of file