/// <summary> Dispose of this fence </summary>
 public void Dispose()
 {
     if (Id != (IntPtr)0)
     {
         GL.DeleteSync(Id);
         GLStatics.RegisterDeallocation(typeof(GLFenceSync));
         Id = (IntPtr)0;
     }
     else
     {
         System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${this.GetType().FullName}");
     }
 }
示例#2
0
 /// <summary> </summary>
 public void Dispose()           // you can double dispose.
 {
     if (Id != -1)
     {
         GL.DeleteShader(Id);
         GLStatics.RegisterDeallocation(typeof(GLShader));
         Id = -1;
     }
     else
     {
         System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${this.GetType().FullName}");
     }
 }
示例#3
0
 /// <summary> Dispose of the vertex array </summary>
 public virtual void Dispose()
 {
     if (Id != -1)
     {
         GL.DeleteVertexArray(Id);
         GLStatics.RegisterDeallocation(typeof(GLVertexArray));
         Id = -1;
     }
     else
     {
         System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${this.GetType().FullName}");
     }
 }
示例#4
0
        /// <summary> Dispose of the query </summary>

        public override void Dispose()               // when dispose, delete query
        {
            if (Id != -1)
            {
                GL.DeleteQuery(Id);
                GLStatics.RegisterDeallocation(typeof(GLOperationQuery));
                Id = -1;
                GLStatics.Check();
            }
            else
            {
                System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${this.GetType().FullName}");
            }
        }
示例#5
0
 /// <summary> Dispose of the object </summary>
 public void Dispose()
 {
     if (Id != -1)
     {
         GL.DeleteTransformFeedback(Id);
         GLStatics.RegisterDeallocation(typeof(GLTransformFeedback));
         GLStatics.Check();
         Id = -1;
     }
     else
     {
         System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${this.GetType().FullName}");
     }
 }
        /// <summary> Dispose of the shader</summary>
        public virtual void Dispose()
        {
            if (pipelineid != -1)
            {
                foreach (var x in shaders)
                {
                    x.Value.Dispose();
                }

                GL.DeleteProgramPipeline(pipelineid);
                GLStatics.RegisterDeallocation(typeof(GLShaderPipeline));
                pipelineid = -1;
            }
            else
            {
                System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of ${GetType().FullName}");
            }
        }
        /// <summary>Dispose of texture, will free bitmaps if owned</summary>
        public void Dispose()           // you can double dispose.
        {
            System.Diagnostics.Debug.Assert(context == GLStatics.GetContext(), "Context incorrect");
            if (Id >= 0)
            {
                if (arbid != -1)                                                       // if its been arb'd, de-arb it
                {
                    OpenTK.Graphics.OpenGL.GL.Arb.MakeTextureHandleNonResident(arbid); // can't do this twice!
                    arbid = -1;
                }

                GL.DeleteTexture(Id);
                GLStatics.RegisterDeallocation(GetType());
                Id = -2;    // -2 means made, then destroyed

                if (BitMaps != null)
                {
                    for (int i = 0; i < BitMaps.Length; i++)
                    {
                        if (OwnBitMaps[i] && BitMaps[i] != null)     // we may have empty spaces in the bitmap list
                        {
                            BitMaps[i].Dispose();
                        }
                    }

                    BitMaps    = null;
                    OwnBitMaps = null;
                }
            }
            else
            {
                if (Id == -2)                                                                                                         // goes -1 -> ID -> -2, never uses stays as -1
                {
                    System.Diagnostics.Trace.WriteLine($"OFC Warning - double disposing of a texture block in {GetType().FullName}"); // only an warning due to the fact you can create and not use
                }
            }
        }