Beispiel #1
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         vbo.Dispose();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Deletes the vertex array from the GPU and will also dispose of any child VBOs if (DisposeChildren == true).
        /// </summary>
        public void Dispose()
        {
            // first try to dispose of the vertex array
            if (vaoID != 0)
            {
                Gl.DeleteVertexArrays(1, new uint[] { vaoID });

                vaoID = 0;
            }

            // children must be disposed of separately since OpenGL 2.1 will not have a vertex array
            if (DisposeChildren)
            {
                if (vertex != null)
                {
                    vertex.Dispose();
                }
                if (normal != null)
                {
                    normal.Dispose();
                }
                if (tangent != null)
                {
                    tangent.Dispose();
                }
                if (uv != null)
                {
                    uv.Dispose();
                }
                if (element != null)
                {
                    element.Dispose();
                }

                vertex  = null;
                normal  = null;
                tangent = null;
                uv      = null;
                element = null;
            }
        }