Example #1
0
        public CubeModel()
        {
            vao           = new VertexArray();
            shaderProgram = new ShaderProgram();
            shaderProgram.AddShader(ShaderType.VertexShader, VERT_SHADER);
            shaderProgram.AddShader(ShaderType.FragmentShader, FRAG_SHADER);
            shaderProgram.Link();
            tex = new Texture("fanera.jpg");

            Vertex[] data;
            UInt32[] indexes;

            var of = new ObjFile("cube.3dobj");

            of.GetGeometry(out data, out indexes);

            elementCount = indexes.Length;
            ibo          = new IndexBuffer(indexes);

            using (var vbo = new VertexBuffer(data))
            {
                vao.AddBuffer(vbo, shaderProgram, Vertex.Attributes);
            }
        }