예제 #1
0
        public VertexArrayObject(GL gl, BufferObject <TVertexType> vbo, BufferObject <TIndexType> ebo)
        {
            _gl = gl;

            _handle = _gl.GenVertexArray();
            Bind();
            vbo.Bind();
            ebo.Bind();
        }
예제 #2
0
        private static unsafe void OnLoad()
        {
            Gl = GL.GetApi(view);

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

            Vao.VertexAttributePointer(0, 3, VertexAttribPointerType.Float, 5, 0);
            Vao.VertexAttributePointer(1, 2, VertexAttribPointerType.Float, 5, 3);

            Shader = new Shader(Gl, "shader.vert", "shader.frag");

            //Loading a texture.
            Texture = new Texture(Gl, "silk.png");
            Gl.ClearColor(1, 1, 1, 1);
        }