示例#1
0
 protected override unsafe void Release()
 {
     fixed(uint *addr = &_hdc)
     {
         Gl.DeleteVertexArrays(1, addr);
     }
 }
示例#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)
            {
                for (int i = 0; i < vbos.Length; i++)
                {
                    Gl.DeleteBuffer(vbos[i].vboID);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Delete a BufferObject name.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for deleting this buffer object name.
        /// </param>
        /// <param name="name">
        /// A <see cref="UInt32"/> that specify the object name to delete.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Exception thrown if <paramref name="ctx"/> is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="ctx"/> is not current on the calling thread.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// Exception thrown if this BufferObject does not exist.
        /// </exception>
        protected override void DeleteName(GraphicsContext ctx, uint name)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (ctx.IsCurrent == false)
            {
                throw new ArgumentException("not current");
            }
            if (Exists(ctx) == false)
            {
                throw new InvalidOperationException("not existing");
            }

            Debug.Assert(ctx.Caps.GlExtensions.VertexArrayObject_ARB);

            // Delete buffer object
            Gl.DeleteVertexArrays(name);
        }
示例#4
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;
            }
        }
示例#5
0
        protected virtual void Dispose(bool disposing)
        {
            // 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)
            {
                for (int i = 0; i < vbos.Length; i++)
                {
                    if (vbos[i].bufferTarget == BufferTarget.ElementArrayBuffer && !DisposeElementArray)
                    {
                        continue;
                    }
                    Gl.DeleteBuffer(vbos[i].vboID);
                }
            }
        }
示例#6
0
 /// <summary>
 /// Shortcut for deleting a single texture without created an array to pass to the gl function.
 /// Calls Gl.DeleteVertexArrays(1, id).
 /// </summary>
 /// <param name="vao">The ID of the vertex array to delete.</param>
 public static void DeleteVertexArray(uint vao)
 {
     uint1[0] = vao;
     Gl.DeleteVertexArrays(1, uint1);
 }