Beispiel #1
0
        public Entity(string objectFileName = null, string textureFileName = null, string ext = ".png")
        {
            var      vertex   = OBJLoader.LoadOBJModel(objectFileName);
            RawModel rawModel = Loader.LoadToVAO(vertex, objectFileName);

            model = new TexturedModel(rawModel, Loader.LoadTexture(textureFileName, ext));
        }
Beispiel #2
0
        public void Render(Entity entity, StaticShader shader)
        {
            TexturedModel texturedModel = entity.TexturedModel;
            RawModel      model         = texturedModel.RawModel;

            GL.BindVertexArray(model.vaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);

            Matrix4 transformationMatrix = Maths.CreateTransformationMatrix(
                entity.Position,
                entity.RotationX,
                entity.RotationY,
                entity.RotationZ,
                entity.Scale);

            shader.LoadTransformationMatrix(ref transformationMatrix);

            ModelTexture modelTexture = entity.TexturedModel.Texture;

            shader.LoadShineVariables(modelTexture.ShineDamper, modelTexture.Reflectivity);

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, texturedModel.Texture.TextureID);
            GL.DrawElements(PrimitiveType.Triangles, model.vertexCount, DrawElementsType.UnsignedInt, 0);
            GL.DisableVertexAttribArray(0);
            GL.DisableVertexAttribArray(1);
            GL.DisableVertexAttribArray(2);
            GL.BindVertexArray(0);
        }
 public Entity(TexturedModel model, vec3 position, vec3 rot, float scale)
 {
     this.model = model;
     this.position = position;
     this.rot = rot;
     this.scale = scale;
 }
Beispiel #4
0
 public Entity(TexturedModel model, Vector3 position, Vector3 rotation, float scale)
 {
     this.model    = model;
     this.position = position;
     this.rotation = rotation;
     this.scale    = scale;
 }
        protected override object CreateResourceConfiguration(string fileName)
        {
            var configuration = new TexturedModel();

            configuration.FileName = PathConvert.GetProjectPath(fileName);
            configuration.Name     = Path.GetFileNameWithoutExtension(fileName);
            return(configuration);
        }
Beispiel #6
0
 public Chunk(int xCoord, int yCoord, int zCoord)
 {
     this.xCoord         = xCoord;
     this.yCoord         = yCoord;
     this.zCoord         = zCoord;
     model               = new TexturedModel(MasterRenderer.GlLoader.LoadToDynamicVAO(new float[0], new float[0], new int[0]), BlockLookup.AtlasTexture);
     shape.Localposition = new Vector3(xCoord * 16, yCoord * 16, zCoord * 16);
 }
Beispiel #7
0
 public Entity(TexturedModel model, Vector3 position, float rotX, float rotY, float rotZ, float scale)
 {
     Model    = model;
     Position = position;
     RotX     = rotX;
     RotY     = rotY;
     RotZ     = rotZ;
     Scale    = scale;
 }
Beispiel #8
0
        private bool TextureModelCompare(TexturedModel a, TexturedModel b)
        {
            var equal = (a.texture == b.texture &&
                         a.shineDamper == b.shineDamper &&
                         a.reflectivity == b.reflectivity &&
                         a.luminosity == b.luminosity);

            return(equal);
        }
 public Entity(TexturedModel model, Vertex3f position, float rotX, float rotY, float rotZ, float scale)
 {
     this.model    = model;
     this.position = position;
     this.rotX     = rotX;
     this.rotY     = rotY;
     this.rotZ     = rotZ;
     this.scale    = scale;
 }
 private void prepareTexturedModel(TexturedModel model)
 {
     RawModel rawModel = model.getRawModel();
     GL.BindVertexArray(rawModel.getVaoID());
     GL.EnableVertexAttribArray(0);
     GL.EnableVertexAttribArray(1);
     GL.EnableVertexAttribArray(2);
     ModelTexture texture = model.getTexture();
     shader.loadShineVariables(texture.shineDamper, texture.reflectivity);
     GL.ActiveTexture(TextureUnit.Texture0);
     GL.BindTexture(TextureTarget.Texture2D, model.getTexture().getID());
 }
Beispiel #11
0
        protected override void OnLoad(EventArgs e)
        {
            GL.ClearColor(0, 0, 1, 1);

            _texture = new ModelTexture(_loader.LoadTexture(@"Content\whitetexture.png"));
            var model = OBjLoader.LoadObjModel(@"Content\dragon.obj", _loader);

            _texturedModel = new TexturedModel(model, _texture);
            _entity        = new Entity(_texturedModel, new Vector3(0, 0, -25.0f), 0, 0, 0, 1);

            Console.WriteLine("Running OpenGL version: " + GL.GetString(StringName.Version));
        }
        //he changes the render function but Im going to make 2 seperate ones
        public void RenderTexturedModel(TexturedModel texturedModel)
        {
            RawModel model = texturedModel.Model;

            GL.BindVertexArray(model.vaoID);
            GL.EnableVertexArrayAttrib(model.vaoID, 0);
            GL.EnableVertexArrayAttrib(model.vaoID, 1);
            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, texturedModel.ModelTexture.TextureID);
            GL.DrawElements(BeginMode.Triangles, model.vertexCount, DrawElementsType.UnsignedInt, 0);
            GL.DisableVertexArrayAttrib(model.vaoID, 0);
            GL.DisableVertexArrayAttrib(model.vaoID, 1);
            GL.BindVertexArray(0);
        }
Beispiel #13
0
        public void render(TexturedModel texturedModel)
        {
            RawModel model = texturedModel.rawModel;

            Gl.BindVertexArray(model.vaoID);
            Gl.EnableVertexAttribArray(0);
            Gl.EnableVertexAttribArray(1);
            Gl.ActiveTexture(TextureUnit.Texture0);
            Gl.BindTexture(TextureTarget.Texture2d, texturedModel.modelTexture.textureId);
            Gl.DrawElements(PrimitiveType.Triangles, model.vertexCount, DrawElementsType.UnsignedInt, IntPtr.Zero);
            Gl.DisableVertexAttribArray(0);
            Gl.DisableVertexAttribArray(1);
            Gl.BindVertexArray(0);
        }
Beispiel #14
0
        public void ProcessEntity(Entity entity)
        {
            TexturedModel entityModel = entity.model;

            entities.TryGetValue(entityModel, out List <Entity> sameModel);
            if (sameModel != null)
            {
                sameModel.Add(entity);
            }
            else
            {
                entities.Add(entityModel, new List <Entity>(new Entity[] { entity }));
            }
        }
Beispiel #15
0
        private void prepareTexturedModel(TexturedModel model)
        {
            RawModel rawModel = model.rawModel;

            Gl.BindVertexArray(rawModel.vaoID);
            Gl.EnableVertexAttribArray(0);
            Gl.EnableVertexAttribArray(1);
            Gl.EnableVertexAttribArray(2);
            ModelTexture texture = model.modelTexture;

            shader.loadVariables(texture.shineDamper, texture.reflectivity);
            Gl.ActiveTexture(TextureUnit.Texture0);                                // activate texture
            Gl.BindTexture(TextureTarget.Texture2d, model.modelTexture.textureId); // pass coords
        }
Beispiel #16
0
        public void Render(TexturedModel texturedModel)
        {
            RawModel model = texturedModel.Model;

            GL.BindVertexArray(model.VaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, texturedModel.Texture.textureID);
            GL.DrawElements(PrimitiveType.Triangles, model.VertexCount, DrawElementsType.UnsignedInt, 0);
            GL.DisableVertexAttribArray(0);
            GL.DisableVertexAttribArray(1);
            GL.BindVertexArray(0);
        }
Beispiel #17
0
        private void PrepareTexturedModel(TexturedModel texturedModel)
        {
            var rawModel = texturedModel.Model;

            GL.BindVertexArray(rawModel.VaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);

            var texture = texturedModel.Texture;

            shader.LoadShineVariables(texture.ShineDamper, texture.Reflectivity);
            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, texture.TextureId);
        }
Beispiel #18
0
        public void processEntity(Entity entity)
        {
            TexturedModel model = entity.model;

            if (entities.ContainsKey(model))
            {
                entities[model].Add(entity);
            }
            else
            {
                List <Entity> newbatch = new List <Entity>();
                newbatch.Add(entity);
                entities.Add(model, newbatch);
            }
        }
Beispiel #19
0
 public Entity(
     TexturedModel texturedModel,
     Vector3 position,
     float rx,
     float ry,
     float rz,
     float scale)
 {
     this.TexturedModel = texturedModel;
     this.Position      = position;
     this.RotationX     = rx;
     this.RotationY     = ry;
     this.RotationZ     = rz;
     this.Scale         = scale;
 }
Beispiel #20
0
        private void prepareTexturedModel(TexturedModel model)
        {
            RawModel rawModel = model.Model;

            GL.BindVertexArray(rawModel.VaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);

            ModelTexture texture = model.Texture;

            shader.LoadShineVariables(texture.shineDamper, texture.reflectivity);

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, model.Texture.textureID);
        }
        public void Start()
        {
            loader   = new Loader();
            shader   = new StaticShader();
            cam      = new Camera();
            renderer = new Renderer(WIDTH, HEIGHT, shader);

            model = OBJLoader.LoadObjFile("Resources\\stall.obj", loader);
            //model = loader.LoadToVAO(vertices, textureCoords, indicies);
            modelTexture  = new ModelTexture(loader.LoadTexture("Resources\\stallimage.jpg"));
            texturedModel = new TexturedModel(model, modelTexture);

            entity = new Entity(texturedModel, new Vector3(0, 0, -25), 0, 0, 0, 1);

            Run(FPS_CAP);
        }
Beispiel #22
0
        public void ProcessEntity(GameObject entity)
        {
            TexturedModel entityModel  = entity.GetComponent <Entity>().model;
            string        rawModelName = entityModel.rawModel.rawModelName;

            entities.TryGetValue(rawModelName, out List <GameObject> batch);
            if (batch != null)
            {
                batch.Add(entity);
            }
            else
            {
                List <GameObject> newBatch = new List <GameObject>();
                newBatch.Add(entity);
                entities[rawModelName] = newBatch;
            }
        }
Beispiel #23
0
        public void render(TexturedModel texturedModel, StaticShader shader)
        {
            RawModel model = texturedModel.rawModel;

            Gl.BindVertexArray(model.vaoID);
            Gl.EnableVertexAttribArray(0);
            Gl.EnableVertexAttribArray(1);
            // uncomment lines to see shape
            //Matrix4f mat = Maths.createTransformationMatrix(new Vertex3f(0, 0, 0), 0, 0, 0, 1);
            //shader.loadTransformationMatrix(mat);
            Gl.ActiveTexture(TextureUnit.Texture0);                                        // activate texture
            Gl.BindTexture(TextureTarget.Texture2d, texturedModel.modelTexture.textureId); // pass coords
            Gl.DrawElements(PrimitiveType.Triangles, model.vertexCount, DrawElementsType.UnsignedInt, IntPtr.Zero);
            Gl.DisableVertexAttribArray(0);
            Gl.DisableVertexAttribArray(1);
            Gl.BindVertexArray(0);
        }
        public void render(Entity entity, StaticShader shader)
        {
            TexturedModel model    = entity.model;
            RawModel      rawModel = model.rawModel;

            Gl.BindVertexArray(rawModel.vaoID);
            Gl.EnableVertexAttribArray(0);
            Gl.EnableVertexAttribArray(1);
            Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.position, entity.rotX, entity.rotY, entity.rotZ, entity.scale);

            shader.loadTransformationMatrix(transformationMatrix);
            Gl.ActiveTexture(TextureUnit.Texture0);
            Gl.BindTexture(TextureTarget.Texture2d, model.modelTexture.textureId);
            Gl.DrawElements(PrimitiveType.Triangles, rawModel.vertexCount, DrawElementsType.UnsignedInt, IntPtr.Zero);
            Gl.DisableVertexAttribArray(0);
            Gl.DisableVertexAttribArray(1);
            Gl.BindVertexArray(0);
        }
Beispiel #25
0
        public Game()
        {
            this.Display      = new DisplayManager(1280, 720);
            this.Loader       = new Loader();
            this.StaticShader = new StaticShader();
            this.Renderer     = new Renderer(this.StaticShader);

            //this.TestModel = this.Loader.LoadToVAO(vertices, textureCoords, indices);
            this.TestModel = OBJLoader.LoadModelOBJ("dragon", this.Loader);
            this.texture   = new ModelTexture(this.Loader.LoadTexture("white"));
            //this.texture.Reflectivity = 1;
            //this.texture.ShineDamper = 10;
            this.texturedModel = new TexturedModel(this.TestModel, this.texture);
            this.entity        = new Entity(this.texturedModel, new Vector3(0, 0f, -25f), 0, 0, 0, 0.1f);
            this.light         = new Light(new Vector3(0, 0, -30f), new Vector3(1f, 1f, 1f));
            this.camera        = new Camera();

            this.Init();
        }
Beispiel #26
0
        private void prepareTexturedModel(TexturedModel model)
        {
            RawModel rawModel = model.rawModel;

            Gl.BindVertexArray(rawModel.vaoID);
            Gl.EnableVertexAttribArray(0);
            Gl.EnableVertexAttribArray(1);
            Gl.EnableVertexAttribArray(2);
            ModelTexture texture = model.modelTexture;

            if (texture.isHasTransparency)
            {
                MasterRenderer.disableCulling();
            }
            shader.loadFakeLighting(texture.isUseFakeLighting);
            shader.loadVariables(texture.shineDamper, texture.reflectivity);
            Gl.ActiveTexture(TextureUnit.Texture0);                                // activate texture
            Gl.BindTexture(TextureTarget.Texture2d, model.modelTexture.textureId); // pass coords
        }
Beispiel #27
0
        public void PrepareTexturedModel(TexturedModel texturedModel)
        {
            if (texturedModel.hasTransparency)
            {
                MasterRenderer.DisableCulling();
            }
            RawModel model = texturedModel.rawModel;

            GL.BindVertexArray(model.vaoID);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);
            shader.LoadUseFakeLightingVariable(texturedModel.useFakeLighting);
            shader.LoadShineVariables(texturedModel.shineDamper, texturedModel.reflectivity, texturedModel.luminosity);
            shader.LoadEnviromentMap(1);
            GL.ActiveTexture(TextureUnit.Texture1);
            GL.BindTexture(TextureTarget.TextureCubeMap, SkyboxRenderer.skyboxTextureID);
            texturedModel.BindTexture(OpenTK.Graphics.OpenGL4.TextureUnit.Texture0);
        }
        public void RenderEntity(Entity ent, StaticShader shader)
        {
            TexturedModel texturedModel = ent.Model;
            RawModel      model         = texturedModel.Model;

            GL.BindVertexArray(model.vaoID);
            GL.EnableVertexArrayAttrib(model.vaoID, 0);
            GL.EnableVertexArrayAttrib(model.vaoID, 1);

            Matrix4 transformationMatrix = Maths.CreateTransformationMatrix(ent.Position, ent.RotationX, ent.RotationY, ent.RotationZ, ent.Scale);

            shader.LoadTransformationMatrix(transformationMatrix);

            GL.ActiveTexture(TextureUnit.Texture0);
            GL.BindTexture(TextureTarget.Texture2D, texturedModel.ModelTexture.TextureID);
            GL.DrawElements(BeginMode.Triangles, model.vertexCount, DrawElementsType.UnsignedInt, 0);
            GL.DisableVertexArrayAttrib(model.vaoID, 0);
            GL.DisableVertexArrayAttrib(model.vaoID, 1);
            GL.BindVertexArray(0);
        }
Beispiel #29
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            renderer = new MasterRenderer(WIDTH, HEIGHT);
            var playerModelMesh = objLoader.LoadObjModel("player", loader);
            var playerTexture   = new ModelTexture(loader.LoadTexture("texture_player"))
            {
                ShineDamper  = 5.0f,
                Reflectivity = 1.0f
            };
            var texturedPlayerModel = new TexturedModel(playerModelMesh, playerTexture);

            player = new Player(texturedPlayerModel,
                                new Vector3(0.0f, 0.0f, -2.0f),
                                new Vector3(0.0f),
                                0.05f);

            var rawModel = objLoader.LoadObjModel("entity", loader);
            var texture  = new ModelTexture(loader.LoadTexture("texture_entity"))
            {
                ShineDamper  = 10.0f,
                Reflectivity = 1.0f
            };
            var texturedModel = new TexturedModel(rawModel, texture);

            entity = new Entity(texturedModel,
                                new Vector3(0.0f, 0.0f, -7.0f),
                                new Vector3(0.0f),
                                1.0f);

            var terrainTexture = new ModelTexture(loader.LoadTexture("texture_terrain"));

            for (int x = -1; x < 1; x++)
            {
                for (int z = -1; z < 1; z++)
                {
                    terrain.Add(new Terrain(x, z, loader, terrainTexture));
                }
            }
        }
Beispiel #30
0
        private void generateEntities()
        {
            RawModel      model2       = OBJLoader.LoadOBJModel("dragon", loader);
            TexturedModel staticModel2 = new TexturedModel(model2, new ModelTexture(loader.LoadTexture("Resources/white.png")));

            staticModel2.Texture.reflectivity = 1;
            staticModel2.Texture.shineDamper  = 10;
            trolley = new Entity(staticModel2, new Vector3(0, 5, 0), new Vector3(0, 0, 0), 3);
            entities.Add(trolley);

            RawModel      bunnyModel  = OBJLoader.LoadOBJModel("bunny", loader);
            TexturedModel staticModel = new TexturedModel(bunnyModel, new ModelTexture(loader.LoadTexture("Resources/green.png")));

            staticModel.Texture.reflectivity = 0.5f;
            staticModel.Texture.shineDamper  = 7;

            for (int i = -5; i < 5; i += 2)
            {
                for (int j = -5; j < 5; j += 2)
                {
                    entities.Add(new Entity(staticModel, new Vector3(10 * i, 5, 10 * j), new Vector3(0, 0, 0), 0.5f));
                }
            }
        }
        static void Main(string[] args)
        {
            // Initialize OpenGL
            Gl.Initialize();

            // If the library isn't in the environment path we need to set it
            Glfw.ConfigureNativesDirectory("..\\..\\libs/glfw-3.2.1.bin.WIN32/lib-mingw");

            // Initialize the GLFW
            if (!Glfw.Init())
            {
                Environment.Exit(-1);
            }

            // Create a windowed mode window and its OpenGL context
            var window = Glfw.CreateWindow(width, height, "Unreal Engine 4");


            if (!window)
            {
                Glfw.Terminate();
                Environment.Exit(-1);
            }

            // set window icon
            Glfw.Image icon = Utils.getImage("..\\..\\res/logo.png");
            Glfw.SetWindowIcon(window, icon);

            // Make the window's context current
            Glfw.MakeContextCurrent(window);

            // create loder and renderer
            Loader loader = new Loader();


            // create model
            RawModel      fern         = OBJLoader.loadObjModel("fern", loader);
            ModelTexture  fernTexture  = new ModelTexture(loader.loadTexture("..\\..\\res/flower.png"));
            TexturedModel texturedFern = new TexturedModel(fern, fernTexture);

            texturedFern.modelTexture.shineDamper       = 10;
            texturedFern.modelTexture.reflectivity      = 0;
            texturedFern.modelTexture.isHasTransparency = true;

            RawModel      grass         = OBJLoader.loadObjModel("grassModel", loader);
            ModelTexture  grassTexture  = new ModelTexture(loader.loadTexture("..\\..\\res/flower.png"));
            TexturedModel texturedGrass = new TexturedModel(grass, grassTexture);

            texturedGrass.modelTexture.shineDamper       = 10;
            texturedGrass.modelTexture.reflectivity      = 0;
            texturedGrass.modelTexture.isHasTransparency = true;
            texturedGrass.modelTexture.isUseFakeLighting = true;

            RawModel      model       = OBJLoader.loadObjModel("lowPolyTree", loader);
            ModelTexture  texture     = new ModelTexture(loader.loadTexture("..\\..\\res/lowPolyTree.png"));
            TexturedModel staticModel = new TexturedModel(model, texture);

            staticModel.modelTexture.shineDamper  = 10;
            staticModel.modelTexture.reflectivity = 0;
            Entity entity = new Entity(staticModel, new Vertex3f(0, 0, -25), 0, 0, 0, 1);
            Light  light  = new Light(new Vertex3f(0, 0, -20), new Vertex3f(1f, 1f, 1f));

            Random       rand           = new Random();
            ModelTexture terrainTexture = new ModelTexture(loader.loadTexture("..\\..\\res/grass.png"));

            terrainTexture.shineDamper  = 10;
            terrainTexture.reflectivity = 0;
            Terrain terrain  = new Terrain(800, 0, loader, terrainTexture);
            Terrain terrain2 = new Terrain(800, -800, loader, terrainTexture);

            RawModel      tree         = OBJLoader.loadObjModel("normal_tree", loader);
            ModelTexture  treeTexture  = new ModelTexture(loader.loadTexture("..\\..\\res/normal_tree.png"));
            TexturedModel texturedTree = new TexturedModel(tree, treeTexture);


            Random random = new Random();

            Camera camera = new Camera();

            List <Entity> allCubes = new List <Entity>();
            List <Entity> allGrass = new List <Entity>();
            List <Entity> allFerns = new List <Entity>();
            List <Entity> allTrees = new List <Entity>();

            for (int i = 0; i < 1000; i++)
            {
                double x = random.NextDouble() * -1600 + 800;
                double y = 0;
                double z = random.NextDouble() * -2410;
                allCubes.Add(new Entity(staticModel, new Vertex3f((float)x, (float)y, (float)z), 0, 0, 0, rand.Next(1, 4)));
            }
            for (int i = 0; i < 1000; i++)
            {
                double x = random.NextDouble() * -1600 + 800;
                double y = 0;
                double z = random.NextDouble() * -2410;
                allGrass.Add(new Entity(texturedGrass, new Vertex3f((float)x, (float)y, (float)z), 0, 0, 0, 3));
            }
            for (int i = 0; i < 1000; i++)
            {
                double x = random.NextDouble() * -1600 + 800;
                double y = 0;
                double z = random.NextDouble() * -2410;
                allFerns.Add(new Entity(texturedFern, new Vertex3f((float)x, (float)y, (float)z), 0, 0, 0, 3));
            }

            MasterRenderer renderer = new MasterRenderer(new WinowInfo(width, height));

            // Loop until the user closes the window
            while (!Glfw.WindowShouldClose(window))
            {
                //entity.increasePosition(0, 0, -0.1f);
                entity.increaseRotation(0, 1, 0);

                // Render here
                camera.move(window);

                renderer.processTerrain(terrain);
                renderer.processTerrain(terrain2);

                foreach (Entity cube in allCubes)
                {
                    renderer.processEntity(cube);
                }
                foreach (Entity gr in allGrass)
                {
                    renderer.processEntity(gr);
                }
                foreach (Entity fr in allFerns)
                {
                    renderer.processEntity(fr);
                }
                foreach (Entity tr in allTrees)
                {
                    renderer.processEntity(tr);
                }


                renderer.render(light, camera);

                //Swap front and back buffers
                Glfw.SwapBuffers(window);

                // Poll for and process events
                Glfw.PollEvents();
            }

            // clean memory
            renderer.cleanUP();
            loader.CleanUp();

            // terminate program
            Glfw.Terminate();
        }
        static void Main(string[] args)
        {
            // Initialize OpenGL
            Gl.Initialize();


            // If the library isn't in the environment path we need to set it
            Glfw.ConfigureNativesDirectory("..\\..\\libs/glfw-3.2.1.bin.WIN32/lib-mingw");

            // Initialize the GLFW
            if (!Glfw.Init())
            {
                Environment.Exit(-1);
            }

            // Create a windowed mode window and its OpenGL context
            var window = Glfw.CreateWindow(width, height, "OpenGL/Glfw");

            if (!window)
            {
                Glfw.Terminate();
                Environment.Exit(-1);
            }

            // Make the window's context current
            Glfw.MakeContextCurrent(window);

            // create shaders after creating opengl context
            StaticShader shader = new StaticShader();

            // create loder and renderer
            Renderer renderer = new Renderer();
            Loader   loader   = new Loader();


            // set data

            float[] vertices =
            {
                -0.5f,  0.5f, 0f, //v0
                -0.5f, -0.5f, 0f, //v1
                0.5f,  -0.5f, 0f, //v2
                0.5f,   0.5f, 0f, //v3
            };

            uint[] indices =
            {
                0, 1, 3, //top left triangle (v0, v1, v3)
                3, 1, 2  //bottom right triangle (v3, v1, v2)
            };

            float[] textureCoords =
            {
                0, 0, //v0
                0, 1, //v1
                1, 1, //v2
                1, 0, //v3
            };


            // create model
            RawModel      model       = loader.LoadToVao(vertices, textureCoords, indices);
            ModelTexture  texture     = new ModelTexture(loader.loadTexture("..\\..\\res/c.jpeg"));
            TexturedModel staticModel = new TexturedModel(model, texture);


            // Loop until the user closes the window
            while (!Glfw.WindowShouldClose(window))
            {
                // Render here
                renderer.prepare();
                shader.start();
                renderer.render(staticModel);
                shader.stop();

                //Swap front and back buffers
                Glfw.SwapBuffers(window);

                // Poll for and process events
                Glfw.PollEvents();
            }

            // clean memory
            shader.cleanUP();
            loader.CleanUp();

            // terminate program
            Glfw.Terminate();
        }