Example #1
0
        public MeshRenderer(Mesh model)
        {
            Tiling = new Vector2(1, 1);

            vbo = new GLArrayBuffer(BufferUsageHint.StaticDraw);
            ebo = new GLElementBuffer(BufferUsageHint.StaticDraw);
            vao = new GLVertexArray();

            vao.Bind();
            vbo.Bind();
            ebo.Bind();

            vbo.SetData(model.Compact());
            ebo.SetData(model.indices.ToArray());
            indicesCount = model.indices.Count;

            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 12 * sizeof(float), 0);
            GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, 12 * sizeof(float), (3 * 4) + (2 * 4));
            GL.VertexAttribPointer(2, 2, VertexAttribPointerType.Float, false, 12 * sizeof(float), 3 * 4);
            GL.VertexAttribPointer(3, 4, VertexAttribPointerType.Float, false, 12 * sizeof(float), (3 * 4) + (2 * 4) + (3 * 4));
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);
            GL.EnableVertexAttribArray(3);

            GLArrayBuffer.Unbind();

            GLVertexArray.Unbind();

            GLElementBuffer.Unbind();
        }
Example #2
0
 public FullScreenQuad()
 {
     vao = new GLVertexArray();
     ebo = new GLElementBuffer(BufferUsageHint.StaticDraw);
     vbo = new GLArrayBuffer(BufferUsageHint.StaticDraw);
     Setup();
 }
Example #3
0
 public override void Release()
 {
     if (vao != null)
     {
         vao.Release();
         vao = null;
     }
     if (ebo != null)
     {
         ebo.Release();
         ebo = null;
     }
     if (vbo != null)
     {
         vbo.Release();
         vbo = null;
     }
 }
Example #4
0
        void Setup()
        {
            vao.Bind();

            vbo.Bind();
            vbo.SetData(buffer);

            ebo.Bind();
            ebo.SetData(indices);

            IGL.Primary.VertexAttribPointer(0, 3, (int)VertexAttribPointerType.Float, false, 5 * sizeof(float), 0);
            IGL.Primary.VertexAttribPointer(1, 2, (int)VertexAttribPointerType.Float, false, 5 * sizeof(float), 3 * 4);
            IGL.Primary.EnableVertexAttribArray(0);
            IGL.Primary.EnableVertexAttribArray(1);
            GLVertexArray.Unbind();
            GLElementBuffer.Unbind();
            GLArrayBuffer.Unbind();
        }