Пример #1
0
        public VertexArrayObject(GL gl, BufferObject <TVertexType> vbo, BufferObject <TIndexType> ebo)
        {
            //Saving the GL instance.
            _gl = gl;

            //Setting out handle and binding the VBO and EBO to this VAO.
            _handle = _gl.GenVertexArray();
            Bind();
            vbo.Bind();
            ebo?.Bind();
        }
Пример #2
0
        private unsafe static void OnLoad()
        {
            Gl = GL.GetApi(view);

            input = view.CreateInput();

            input.Mice[0].MouseMove += MouseMove;
            input.Mice[0].MouseDown += MouseDown;

            input.Keyboards[0].KeyChar += KeyChar;

            Vbo = new BufferObject <float>(Gl, Vertices, BufferTargetARB.ArrayBuffer);
            Vao = new VertexArrayObject <float, uint>(Gl, Vbo, null);

            Vao.VertexAttributePointer(0, 3, VertexAttribPointerType.Float, 7, 0);
            Vao.VertexAttributePointer(1, 4, VertexAttribPointerType.Float, 7, 3);

            Shader     = new Shader(Gl, "shader.vert", "shader.frag");
            projection = Matrix4x4.CreateOrthographic(
                view.Size.X,
                -view.Size.Y,
                1.0f, 2.0f);
        }