예제 #1
0
        public void Render(RawModel model)
        {
            GL.BindVertexArray(model.VaoId);
            GL.EnableVertexAttribArray(0);
            //GL.BindBuffer(BufferTarget.ArrayBuffer, model.VboId);
            //GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);


            //GL.BindBuffer(BufferTarget.ElementArrayBuffer, model.IboId);
            GL.DrawElements(PrimitiveType.Triangles, model.VertexCount, DrawElementsType.UnsignedInt, IntPtr.Zero);
        }
예제 #2
0
        public Game(int width, int height) : base(width, height)
        {
            _loader   = new ModelLoader();
            _renderer = new Renderer();
            _shader   = new StaticShader();

            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
            };
            int[] indices =
            {
                0, 3, 1,
                3, 1, 2
            };

            _shader.Load();
            _model = _loader.LoadToVao(vertices, indices);
        }