private void cleanUp() {
    // System.err.println( "VolumeImageViewerPoint dispose()" );
    if (m_kHistogramPoints2D != null) {
      m_pkRenderer.ReleaseResources(m_kHistogramPoints2D);
      m_kHistogramPoints2D.dispose();
      m_kHistogramPoints2D = null;
    }
    if (m_kEntropyPoints2D != null) {
      m_pkRenderer.ReleaseResources(m_kEntropyPoints2D);
      m_kEntropyPoints2D.dispose();
      m_kEntropyPoints2D = null;
    }
    if (m_kImagePointsDual != null) {
      m_kImagePointsDual.DetachAllEffects();
      m_pkRenderer.ReleaseResources(m_kImagePointsDual);
      m_kImagePointsDual.dispose();
      m_kImagePointsDual = null;
    }

    if (m_kHistogramOutput != null) {
      m_kHistogramOutput.GetTarget(0).GetImage().dispose();
      m_kHistogramOutput.GetTarget(0).dispose();
      m_kHistogramOutput.TerminateBuffer();
      m_kHistogramOutput.dispose();
    }
    if (m_kHistogramOutputB != null) {
      m_kHistogramOutputB.GetTarget(0).GetImage().dispose();
      m_kHistogramOutputB.GetTarget(0).dispose();
      m_kHistogramOutputB.TerminateBuffer();
      m_kHistogramOutputB.dispose();
    }
    if (m_kEntropyOut != null) {
      m_kEntropyOut.GetTarget(0).GetImage().dispose();
      m_kEntropyOut.GetTarget(0).dispose();
      m_kEntropyOut.TerminateBuffer();
      m_kEntropyOut.dispose();
    }
    if (m_akImageReduceEntropy != null) {
      m_pkRenderer.ReleaseResources(m_akImageReduceEntropy);
      m_akImageReduceEntropy.dispose();
    }
    if (m_akCollapse2D != null) {
      m_pkRenderer.ReleaseResources(m_akCollapse2D);
      m_akCollapse2D.dispose();
    }
    if (m_akCollapseColumns != null) {
      m_pkRenderer.ReleaseResources(m_akCollapseColumns);
      m_akCollapseColumns.dispose();
    }
    if (m_akCollapseRows != null) {
      m_pkRenderer.ReleaseResources(m_akCollapseRows);
      m_akCollapseRows.dispose();
    }
  }
  public void dispose(GLAutoDrawable arg0) {

    cleanUp();
    if (m_kTextureA != null) {
      m_kTextureA.Release();
      m_kTextureA.GetImage().dispose();
      m_kTextureA.dispose();
      m_kTextureA = null;
    }
    if (m_kTextureB != null) {
      m_kTextureB.Release();
      m_kTextureB.GetImage().dispose();
      m_kTextureB.dispose();
      m_kTextureB = null;
    }

    if (m_kBracketPoints != null) {
      m_pkRenderer.ReleaseResources(m_kBracketPoints);
      m_kBracketPoints.dispose();
      m_kBracketPoints = null;
    }
    if (m_kTransformPoints != null) {
      m_pkRenderer.ReleaseResources(m_kTransformPoints);
      m_kTransformPoints.dispose();
      m_kTransformPoints = null;
    }

    if (m_kImageEffectDual != null) {
      m_pkRenderer.ReleaseResources(m_kImageEffectDual);
      m_kImageEffectDual.dispose();
    }
    if (m_kImageLineMinDual != null) {
      m_pkRenderer.ReleaseResources(m_kImageLineMinDual);
      m_kImageLineMinDual.dispose();
    }
    if (m_kCalcTransform != null) {
      m_pkRenderer.ReleaseResources(m_kCalcTransform);
      m_kCalcTransform.dispose();
    }

    if (m_kBracketOut != null) {
      m_kBracketOut.GetTarget(0).GetImage().dispose();
      m_kBracketOut.GetTarget(0).dispose();
      m_kBracketOut.TerminateBuffer();
      m_kBracketOut.dispose();
    }
    if (m_kTransformOut != null) {
      m_kTransformOut.GetTarget(0).GetImage().dispose();
      m_kTransformOut.GetTarget(0).dispose();
      m_kTransformOut.TerminateBuffer();
      m_kTransformOut.dispose();
    }
    if (m_kBracketNewOut != null) {
      m_kBracketNewOut.GetTarget(0).GetImage().dispose();
      m_kBracketNewOut.GetTarget(0).dispose();
      m_kBracketNewOut.TerminateBuffer();
      m_kBracketNewOut.dispose();
    }

    ImageCatalog.GetActive().dispose();
    VertexProgramCatalog.GetActive().dispose();
    PixelProgramCatalog.GetActive().dispose();
    CompiledProgramCatalog.GetActive().dispose();

    super.dispose();
  }