開放、情報取得

開放、情報取得




画像の開放をしないといずれメモリ不足になってハングしてしまいます。
今回は画像の開放と画像情報の取得をやります。

Texture.java
    //  開放
    public void Release()
    {
        if( m_DrawDevice != null )
        {
            GL10    gl      = m_DrawDevice.GetGl();
            int[]   aTexID  = new int[ 1 ];
            {
                aTexID[ 0 ] = m_TexID;
                gl.glDeleteTextures( 1, aTexID, 0 );
            }
        }
        _Clear();
    }

    //  各種取得
    final public boolean    IsLoaded()          { return ( m_DrawDevice != null );  }
    final public int        GetTextureBindID()  { return m_TexID;                   }
    final public int        GetWidth()          { return m_ImageWidth;              }
    final public int        GetHeight()         { return m_ImageHeight;         }

Releaseメソッドではロード時に作ったテクスチャIDを使ってOpenGLにテクスチャを削除してもらってます。
……特に難しいことはないですね。。。



<前のページ