commit 8ae20b7159041f4bb7f89719cf3a6262e927d56d Author: Harald Christian Joachim Wolff Date: Thu Apr 20 16:49:43 2017 +0200 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e82d27 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Autosave files +*~ + +# build +[Oo]bj/ +[Bb]in/ +packages/ +TestResults/ + +# globs +Makefile.in +*.DS_Store +*.sln.cache +*.suo +*.cache +*.pidb +*.userprefs +*.usertasks +config.log +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.user +*.tar.gz +tarballs/ +test-results/ +Thumbs.db + +# Mac bundle stuff +*.dmg +*.app + +# resharper +*_Resharper.* +*.Resharper + +# dotCover +*.dotCover diff --git a/BootStrap.cs b/BootStrap.cs new file mode 100644 index 0000000..9128882 --- /dev/null +++ b/BootStrap.cs @@ -0,0 +1,58 @@ +using System; + +using OpenTK.Graphics.OpenGL4; +using OpenTK; + +namespace nhengine +{ + public class BootStrap + { + public static BootStrap _instance; + public static BootStrap instance() + { + return _instance; + } + + OpenGLWindow glWindow; + Graphics graphics; + + SquaredMap map; + + public static void Main(string[] args){ + _instance = new BootStrap(); + + _instance.run(); + + } + + public BootStrap() + { + bootGraphics(); + bootMap(); + } + + public SquaredMap SquaredMap { + get { return this.map; } + } + + public void bootGraphics(){ + glWindow = new OpenGLWindow(); + graphics = new Graphics(); + } + + public void bootMap(){ + map = new SquaredMap(25,25); + } + + + public void run(){ + glWindow.MakeCurrent(); + + glWindow.Run(30,30); + } + + + + + } +} diff --git a/GLCamera.cs b/GLCamera.cs new file mode 100644 index 0000000..fae761f --- /dev/null +++ b/GLCamera.cs @@ -0,0 +1,86 @@ +using System; + +using OpenTK.Graphics.OpenGL; +using OpenTK.Graphics; +using OpenTK; + +namespace nhengine +{ + public class GLCamera + { + Matrix4 position, + projection, + rotation, + lookat; + + Matrix4 result; + + float arc_z, + arc_x; + float distance; + + public GLCamera() + { + lookat = Matrix4.CreateTranslation(1600, 1600, 0); + + distance = 2500.0f; + + projection = Matrix4.CreatePerspectiveFieldOfView( + MathHelper.PiOver4, + 1.6f, + 0.5f, + 100000.0f + ); + rotation = Matrix4.CreateScale(1.0f); + + setup(); + } + + public void setViewport(int width,int height){ + projection = Matrix4.CreatePerspectiveFieldOfView( + MathHelper.PiOver4, + width / (float)height, + 0.5f, + 100000.0f + ); + } + + public Matrix4 Rotation { + get { return this.rotation; } + } + + public float ArcZ + { + get { return this.arc_z; } + set { this.arc_z = value; } + } + + public float ArcX + { + get { return this.arc_x; } + set { this.arc_x = value; } + } + + public float Distance { + get { return this.distance; } + set { this.distance = value; } + } + + public void setup(){ + rotation = Matrix4.CreateRotationZ(this.arc_z) * Matrix4.CreateRotationX(this.arc_x); + position = Matrix4.CreateTranslation(0, 0, distance); + + result = Matrix4.Identity; + result *= lookat.Inverted(); + result *= rotation; +// result *= Matrix4.CreateRotationZ(this.arc_z); +// result *= Matrix4.CreateRotationX(this.arc_x); + result *= position.Inverted(); + result *= projection; + } + + public Matrix4 Matrix { + get { return this.result; } + } + } +} diff --git a/Graphics.cs b/Graphics.cs new file mode 100644 index 0000000..72f1997 --- /dev/null +++ b/Graphics.cs @@ -0,0 +1,25 @@ +using System; +using System.IO; + +using OpenTK.Graphics.OpenGL; +using OpenTK; + +namespace nhengine +{ + public class Graphics + { + private TextureManager textureManager; + + public Graphics() + { + this.textureManager = new TextureManager(); + } + + + TextureManager TextureManager { + get { return this.textureManager; } + } + + + } +} diff --git a/OpenGLWindow.cs b/OpenGLWindow.cs new file mode 100644 index 0000000..b9b1577 --- /dev/null +++ b/OpenGLWindow.cs @@ -0,0 +1,124 @@ +using System; +using System.Drawing; + +using OpenTK.Graphics; +using OpenTK.Graphics.OpenGL; +using OpenTK; + +namespace nhengine +{ + + + + public class OpenGLWindow : GameWindow + { + private GLCamera camera; + + private Point mouseCapturePosition; + private bool mouseCaptured; + + public OpenGLWindow() + :base(800, 600, + GraphicsMode.Default, + "nhEngine", + GameWindowFlags.Default, + DisplayDevice.Default, + 3, 3, + GraphicsContextFlags.ForwardCompatible) + { + VSync = VSyncMode.On; + camera = new GLCamera(); + camera.ArcX = -MathHelper.PiOver3; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f); + GL.Enable(EnableCap.DepthTest); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + + GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height); + camera.setViewport(ClientRectangle.Width, ClientRectangle.Height); + } + + protected override void OnRenderFrame(FrameEventArgs e) + { + base.OnRenderFrame(e); + + BootStrap boot = BootStrap.instance(); + + GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); + + //camera.ArcX = -MathHelper.PiOver2 * 0.8f; + //camera.ArcZ += MathHelper.Pi / 180; + + camera.setup(); + + boot.SquaredMap.paint(camera); + + SwapBuffers(); + } + + private void captureMouse(){ + mouseCapturePosition = new Point(Mouse.X, Mouse.Y); + mouseCaptured = true; + CursorVisible = false; + } + + private void releaseMouse(){ + mouseCaptured = false; + CursorVisible = true; + } + + protected override void OnMouseMove(OpenTK.Input.MouseMoveEventArgs e) + { + if (mouseCaptured){ + Point delta = new Point(e.X - mouseCapturePosition.X, e.Y - mouseCapturePosition.Y); + onMouseCapturedMove(delta); + mouseCapturePosition = e.Position; + } + } + + protected virtual void onMouseCapturedMove(Point delta){ + camera.ArcZ += ((float)delta.X) / 100.0f; + camera.ArcX += ((float)delta.Y) / 100.0f; + + if (camera.ArcX > 0.0f){ + camera.ArcX = 0.0f; + } + + if (camera.ArcX < -MathHelper.PiOver2){ + camera.ArcX = -MathHelper.PiOver2; + } + + + + } + + protected override void OnMouseDown(OpenTK.Input.MouseButtonEventArgs e) + { + switch (e.Button){ + case OpenTK.Input.MouseButton.Left: + break; + case OpenTK.Input.MouseButton.Right: + captureMouse(); + break; + } + } + + protected override void OnMouseUp(OpenTK.Input.MouseButtonEventArgs e) + { + releaseMouse(); + } + + protected override void OnMouseWheel(OpenTK.Input.MouseWheelEventArgs e) + { + camera.Distance += e.DeltaPrecise * 16.0f; + } + } +} diff --git a/OpenTK.dll.config b/OpenTK.dll.config new file mode 100644 index 0000000..7098d39 --- /dev/null +++ b/OpenTK.dll.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Shader.cs b/Shader.cs new file mode 100644 index 0000000..289a9b3 --- /dev/null +++ b/Shader.cs @@ -0,0 +1,59 @@ +using System; +using System.IO; + +using OpenTK.Graphics.OpenGL; + +namespace nhengine +{ + public class Shader + { + private int id; + + private ShaderType shaderType; + private String source; + + public Shader(ShaderType shaderType, String source) + { + this.id = GL.CreateShader(shaderType); + + this.shaderType = shaderType; + this.source = source; + + compile(); + } + + public int ID + { + get { return this.id; } + } + + public Shader(ShaderType shaderType, FileStream file) + { + this.id = GL.CreateShader(shaderType); + this.shaderType = shaderType; + + StreamReader sr = new StreamReader(file); + this.source = sr.ReadToEnd(); + + + compile(); + } + + private void compile() + { + GL.ShaderSource(this.id, source); + GL.CompileShader(this.id); + + string msg = GL.GetShaderInfoLog((int)this.id); + + Console.WriteLine("Supported Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion)); + Console.WriteLine("Shader Compiled: {0}", msg); + + } + + public ShaderType ShaderType + { + get { return this.shaderType; } + } + } +} diff --git a/ShaderManager.cs b/ShaderManager.cs new file mode 100644 index 0000000..a2ca320 --- /dev/null +++ b/ShaderManager.cs @@ -0,0 +1,103 @@ +using System; +using System.IO; +using OpenTK.Graphics.OpenGL; +using System.Collections.Generic; + +namespace nhengine { + + public class ShaderManager { + private static ShaderManager _instance; + + private List shaders; + + public ShaderManager(){ + if (_instance == null) + { + _instance = this; + } + + this.shaders = new List(); + } + + void registerShader(Shader shader){ + this.shaders.Add(shader); + } + + public class Shader + { + + private int id; + private ShaderType shaderType; + private String source; + + public Shader(ShaderType shaderType, String source) + { + this.id = GL.CreateShader(shaderType); + + this.shaderType = shaderType; + this.source = source; + + _instance.registerShader(this); + + compile(); + } + + public int ID { + get { return this.id; } + } + + public Shader(ShaderType shaderType,FileStream file){ + this.id = GL.CreateShader(shaderType); + this.shaderType = shaderType; + + StreamReader sr = new StreamReader(file); + this.source = sr.ReadToEnd(); + + _instance.registerShader(this); + + compile(); + } + + private void compile(){ + GL.ShaderSource(this.id, source); + GL.CompileShader(this.id); + + string msg = GL.GetShaderInfoLog((int)this.id); + + Console.WriteLine("Supported Shader Version: {0}", GL.GetString(StringName.ShadingLanguageVersion)); + Console.WriteLine("Shader Compiled: {0}", msg); + + } + + public ShaderType ShaderType { + get { return this.shaderType; } + } + } + + public class ShaderProgram { + + Shader vertexShader; + Shader fragmentShader; + + int id; + + public ShaderProgram(Shader vertexShader, Shader fragmentShader){ + + this.vertexShader = vertexShader; + this.fragmentShader = fragmentShader; + + this.id = GL.CreateProgram(); + + GL.AttachShader(this.id, vertexShader.ID); + GL.AttachShader(this.id, fragmentShader.ID); + GL.LinkProgram(this.id); + Console.WriteLine("Shader Program Result:D {0}", GL.GetProgramInfoLog(this.id)); + } + + public int ID { + get { return this.id; } + } + } + } + +} diff --git a/ShaderProgram.cs b/ShaderProgram.cs new file mode 100644 index 0000000..feae9a0 --- /dev/null +++ b/ShaderProgram.cs @@ -0,0 +1,55 @@ +using System; +using System.IO; + +using OpenTK.Graphics.OpenGL; + +namespace nhengine +{ + public class ShaderProgram + { + + Shader vertexShader; + Shader fragmentShader; + + int id; + + public ShaderProgram(Shader vertexShader, Shader fragmentShader) + { + init(vertexShader, fragmentShader); + } + + public ShaderProgram(String vertexShader, String fragmentShader) + { + init( + new Shader(ShaderType.VertexShader, vertexShader), + new Shader(ShaderType.FragmentShader, fragmentShader) + ); + } + + public ShaderProgram(Stream vertexShader, Stream fragmentShader) + { + init( + new Shader(ShaderType.VertexShader, new StreamReader(vertexShader).ReadToEnd()), + new Shader(ShaderType.FragmentShader, new StreamReader(fragmentShader).ReadToEnd()) + ); + } + + + private void init(Shader vertexShader, Shader fragmentShader){ + this.vertexShader = vertexShader; + this.fragmentShader = fragmentShader; + + this.id = GL.CreateProgram(); + + GL.AttachShader(this.id, vertexShader.ID); + GL.AttachShader(this.id, fragmentShader.ID); + GL.LinkProgram(this.id); + Console.WriteLine("Shader Program Result: {0}", GL.GetProgramInfoLog(this.id)); + } + + public int ID + { + get { return this.id; } + } + } +} diff --git a/SquaredMap.cs b/SquaredMap.cs new file mode 100644 index 0000000..27f8e86 --- /dev/null +++ b/SquaredMap.cs @@ -0,0 +1,177 @@ +using System; +using System.IO; + +using OpenTK.Graphics.OpenGL4; +using OpenTK; + +namespace nhengine +{ + public class SquaredMap + { + private int width, + height; + + private double[] heightMap; + private int[] tileTypes; + + /* GL shared resources */ + private int vao, ebo; + + private int bufVertices; + private float[] + vertices; + private int[] elements; + + private ShaderProgram + shaderProgram; + + public SquaredMap(int width,int height) + { + this.width = width; + this.height = height; + + this.heightMap = new double[getVertexIndex(width,height) + 1]; + this.tileTypes = new int[getTileIndex(width,height) + 1]; + + shaderProgram = new ShaderProgram( + new FileStream("shader/simple_vertex.shader",FileMode.Open), + new FileStream("shader/simple_fragment.shader",FileMode.Open) + ); + + prepareGL(); + computeGL(); + + dumpGL(); + } + + private void prepareGL(){ + vao = GL.GenVertexArray(); + ebo = GL.GenBuffer(); + bufVertices = GL.GenBuffer(); + } + + public void computeGL(){ + int b; + + if (vertices == null){ + vertices = new float[heightMap.Length * 3]; + } + + if (elements == null){ + elements = new int[width * height * 6]; + } + + Random rand = new Random(); + + for (int x = 0; x <= width;x++) + { + for (int y = 0; y <= height;y++){ + b = 3 * getVertexIndex(x, y); + + vertices[b + 0] = 128 * x; + vertices[b + 1] = 128 * y; + vertices[b + 2] = (float)(128 * rand.NextDouble()); + } + } + + for (int x = 0; x < width;x++) + { + for (int y = 0; y < height;y++){ + b = 6 * getTileIndex(x, y); + + elements[b + 0] = x + (y * (width + 1)); + elements[b + 1] = x + (y * (width + 1)) + 1; + elements[b + 2] = x + ((y + 1) * (width + 1)); + +/* + elements[b + 3] = x + ((y + 1) * (width + 1)); + elements[b + 4] = x + (y * (width + 1)) + 1; + elements[b + 5] = x + ((y + 1) * (width + 1)) + 1; +*/ + } + } + + GL.BindVertexArray(vao); + + GL.BindBuffer(BufferTarget.ArrayBuffer, bufVertices); + GL.BufferData(BufferTarget.ArrayBuffer, 4 * vertices.Length, vertices, BufferUsageHint.StaticDraw); + + GL.VertexAttribPointer(0, + 3, + VertexAttribPointerType.Float, + false, + 0, + 0); + GL.EnableVertexAttribArray(0); + + GL.BindBuffer(BufferTarget.ElementArrayBuffer,ebo); + GL.BufferData(BufferTarget.ElementArrayBuffer, 4 * elements.Length, elements, BufferUsageHint.StaticDraw); + + GL.BindVertexArray(0); + } + + void dumpGL(){ + Console.WriteLine("Vertices:"); + for (int x = 0; x < 8;x++){ + Console.WriteLine("{0}", vertices[x]); + } + } + + private int getTileIndex(int x, int y) + { + return x + (y * this.width); + } + private int getVertexIndex(int x,int y){ + return x + (y * (this.width + 1)); + } + + private int getTileType(int x, int y) + { + int ind = getTileIndex(x, y); + if ((ind < 0) || (ind > tileTypes.Length)) + { + return 0; + } + + return this.tileTypes[ind]; + } + + private int getTileType(int ind) + { + if ((ind < 0) || (ind > tileTypes.Length)) + { + return 0; + } + return this.tileTypes[ind]; + } + + private double getHeight(int ind) + { + if ((ind < 0) || (ind > heightMap.Length)) + { + return 0; + } + + return this.heightMap[ind]; + } + + public void paint(GLCamera camera){ + + + Matrix4 pmat = camera.Matrix; + + GL.UseProgram(shaderProgram.ID); + + int pm = GL.GetUniformLocation(shaderProgram.ID, "proj_matrix"); + GL.UniformMatrix4(pm, false, ref pmat); + + GL.BindVertexArray(vao); + + GL.DrawElements(BeginMode.Triangles, elements.Length, DrawElementsType.UnsignedInt, 0); + + GL.BindVertexArray(0); + + } + + } +} diff --git a/TextureManager.cs b/TextureManager.cs new file mode 100644 index 0000000..e6c6cb9 --- /dev/null +++ b/TextureManager.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; + +using OpenTK.Graphics.OpenGL4; + +namespace nhengine +{ + public class TextureManager + { + Dictionary textures; + + Texture defTexture; + + public TextureManager() + { + textures = new Dictionary(); + createDefaultTexture(); + } + + private void createDefaultTexture() + { + defTexture = new Texture(128, 128); + + for (int n = 0; n < 128;n++){ + defTexture.setPixel(0, n, 0x00FFFF00); + defTexture.setPixel(n, 0, 0x00FFFF00); + defTexture.setPixel(127, n, 0x00FFFF00); + defTexture.setPixel(n, 127, 0x00FFFF00); + } + + addTexture(defTexture); + } + + public int addTexture(Texture t) + { + int id = GL.GenTexture(); + GL.BindTexture(TextureTarget.Texture2D, id); + GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, t.Width, t.Height, 0, PixelFormat.Rgba, PixelType.Byte, t.Data); + GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); + + textures.Add(id, t); + + return id; + } + + public class Texture + { + int width, + height; + UInt32[] data; + + public Texture(int width,int height) + { + this.width = width; + this.height = height; + this.data = new UInt32[width * height]; + } + + public UInt32[] Data { + get { return this.data; } + } + + public int Width + { + get { return this.width; } + } + public int Height { + get { return this.height; } + } + + public UInt32 getPixel(int x,int y){ + return data[x + (y * width)]; + } + + public void setPixel(int x, int y, UInt32 rgba) + { + data[x + (y * width)] = rgba; + } + public void setPixel(int x, int y,uint r,uint g,uint b,uint a) + { + data[x + (y * width)] = (r << 0) | (g << 8) | (b << 16) | (a << 24); + } + } + } +} diff --git a/nhengine.csproj b/nhengine.csproj new file mode 100644 index 0000000..5fe58d3 --- /dev/null +++ b/nhengine.csproj @@ -0,0 +1,67 @@ + + + + Debug + x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC} + Exe + nhengine + nhengine + v4.5.1 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + x86 + true + + + true + bin\Release + prompt + 4 + x86 + true + + + Project + bin\Debug + false + false + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + + packages\OpenTK.2.0.0\lib\net20\OpenTK.dll + + + + + \ No newline at end of file diff --git a/nhengine.sln b/nhengine.sln new file mode 100644 index 0000000..ce08228 --- /dev/null +++ b/nhengine.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nhengine", "nhengine.csproj", "{48BC2215-027E-435F-B8DB-336BD9F678FC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pencil.Gaming", "..\Pencil.Gaming\Pencil.Gaming\Pencil.Gaming.csproj", "{DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + Compatibility-GLFW2|Any CPU = Compatibility-GLFW2|Any CPU + Core-GLFW2|Any CPU = Core-GLFW2|Any CPU + Compatibility-GLFW3|Any CPU = Compatibility-GLFW3|Any CPU + Core-GLFW3|Any CPU = Core-GLFW3|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Debug|x86.ActiveCfg = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Debug|x86.Build.0 = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Release|x86.ActiveCfg = Release|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Release|x86.Build.0 = Release|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Core-GLFW2|Any CPU.ActiveCfg = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Core-GLFW2|Any CPU.Build.0 = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Core-GLFW3|Any CPU.ActiveCfg = Debug|x86 + {48BC2215-027E-435F-B8DB-336BD9F678FC}.Core-GLFW3|Any CPU.Build.0 = Debug|x86 + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Debug|x86.ActiveCfg = Debug|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Debug|x86.Build.0 = Debug|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Release|x86.ActiveCfg = Release|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Release|x86.Build.0 = Release|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW2|Any CPU.ActiveCfg = Compatibility-GLFW2|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW2|Any CPU.Build.0 = Compatibility-GLFW2|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW2|Any CPU.ActiveCfg = Core-GLFW2|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW2|Any CPU.Build.0 = Core-GLFW2|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW3|Any CPU.ActiveCfg = Compatibility-GLFW3|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW3|Any CPU.Build.0 = Compatibility-GLFW3|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW3|Any CPU.ActiveCfg = Core-GLFW3|Any CPU + {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW3|Any CPU.Build.0 = Core-GLFW3|Any CPU + EndGlobalSection +EndGlobal diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..30c9bc0 --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/shader/simple_fragment.shader b/shader/simple_fragment.shader new file mode 100644 index 0000000..968003c --- /dev/null +++ b/shader/simple_fragment.shader @@ -0,0 +1,8 @@ +#version 330 + +out vec4 color; + +void main() +{ + color = vec4(1.0f, 0.5f, 0.2f, 1.0f); +} diff --git a/shader/simple_vertex.shader b/shader/simple_vertex.shader new file mode 100644 index 0000000..2cd23b5 --- /dev/null +++ b/shader/simple_vertex.shader @@ -0,0 +1,11 @@ +#version 330 + +layout (location = 0) in vec3 position; + +uniform mat4 proj_matrix2; +uniform mat4 proj_matrix; + +void main() +{ + gl_Position = proj_matrix * vec4(position.x, position.y, position.z, 1.0) ; +}