示例#1
0
        private void Dispose(bool isDisposing)
        {
            if (TextureGl != null)
            {
//                if (fboDepthBuffer >= 0)
//                {
//#if iOS
//                    GL.Oes.DeleteRenderbuffers(1, ref fboDepthBuffer);
//#else
//                    GL.DeleteRenderbuffers(1, ref fboDepthBuffer);
//#endif
//                    fboDepthBuffer = -1;
//                }

                if (fboId >= 0)
                {
#if iOS
                    GL.Oes.DeleteFramebuffers(1, ref fboId);
                    fboId = -1;
#else
                    GL.DeleteFramebuffers(1, ref fboId);
                    fboId = -1;
#endif
                    fboSingleton = -1;
                }


                TextureGl.Dispose();
                TextureGl = null;
            }

            IsDisposed = true;
        }
示例#2
0
 /// <summary>
 /// Disposes of textures but leaves the GC finalizer in place.
 /// This is used to temporarily unload sprites which are not accessed in a while.
 /// </summary>
 internal void TemporalDispose()
 {
     if (TextureGl != null)
     {
         TextureGl.Dispose();
         TextureGl = null;
     }
 }
示例#3
0
        public pTexture(TextureGl textureGl, int width, int height)
        {
            TextureGl = textureGl;
            Width     = width;
            Height    = height;

#if DEBUG
            id = staticid++;
#endif
        }
示例#4
0
        internal bool ReloadIfPossible()
        {
            if (TextureGl == null || TextureGl.Id == -1)
            {
                if (assetName != null || OsuTextureInfo != OsuTexture.None)
                {
                    pTexture reloadedTexture = OsuTextureInfo != OsuTexture.None ? TextureManager.Load(OsuTextureInfo) : FromFile(assetName);
                    if (TextureGl == null)
                    {
                        TextureGl = reloadedTexture.TextureGl;
                    }
                    else
                    {
                        TextureGl.Id = reloadedTexture.TextureGl.Id;
                    }

                    reloadedTexture.TextureGl = null; //deassociate with temporary pTexture to avoid disposal.

                    return(true);
                }
            }

            return(false);
        }