Beispiel #1
0
  public DemoBase(
      final String acWindowTitle,
      int iXPosition,
      int iYPosition,
      int iWidth,
      int iHeight,
      FrameBuffer.FormatType eFormat,
      FrameBuffer.DepthType eDepth,
      FrameBuffer.StencilType eStencil,
      FrameBuffer.BufferingType eBuffering,
      FrameBuffer.MultisamplingType eMultisampling,
      final ColorRGBA rkBackgroundColor) {
    super(acWindowTitle, iXPosition, iYPosition, iWidth, iHeight, rkBackgroundColor);
    m_eFormat = eFormat;
    m_eDepth = eDepth;
    m_eStencil = eStencil;
    m_eBuffering = eBuffering;
    m_eMultisampling = eMultisampling;

    m_pkRenderer =
        new OpenGLRenderer(
            m_eFormat, m_eDepth, m_eStencil, m_eBuffering, m_eMultisampling, m_iWidth, m_iHeight);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().setSize(m_iWidth, m_iHeight);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addGLEventListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addKeyListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addMouseListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addMouseMotionListener(this);

    String kExternalDirs = getExternalDirs();
    ImageCatalog.SetActive(new ImageCatalog("Main", kExternalDirs));
    VertexProgramCatalog.SetActive(new VertexProgramCatalog("Main", kExternalDirs));
    PixelProgramCatalog.SetActive(new PixelProgramCatalog("Main", kExternalDirs));
    CompiledProgramCatalog.SetActive(new CompiledProgramCatalog());
  }
 public ImageRegistrationGPU(ModelSimpleImage kTarget, ModelSimpleImage kMoving) {
   // super( "VolumeImageViewer", 0, 0, kImageA.extents[0],kImageA.extents[1],
   super("ImageRegistrationGPU", 0, 0, 256, 256, new ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f));
   m_pkRenderer =
       new OpenGLRenderer(
           m_eFormat, m_eDepth, m_eStencil, m_eBuffering, m_eMultisampling, m_iWidth, m_iHeight);
   GetCanvas().getContext().setSynchronized(true);
   m_kTarget = kTarget;
   m_kMoving = kMoving;
   String kExternalDirs = MipavInitGPU.getExternalDirs();
   ImageCatalog.SetActive(new ImageCatalog("Main", kExternalDirs));
   VertexProgramCatalog.SetActive(new VertexProgramCatalog("Main", kExternalDirs));
   PixelProgramCatalog.SetActive(new PixelProgramCatalog("Main", kExternalDirs));
   CompiledProgramCatalog.SetActive(new CompiledProgramCatalog());
 }
Beispiel #3
0
  public DemoBase(String title) {
    super(title, 0, 0, 512, 512, new ColorRGBA(0.635294f, 0.917647f, 1.0f, 1.0f));
    m_pkRenderer =
        new OpenGLRenderer(
            m_eFormat, m_eDepth, m_eStencil, m_eBuffering, m_eMultisampling, m_iWidth, m_iHeight);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().setSize(m_iWidth, m_iHeight);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addGLEventListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addKeyListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addMouseListener(this);
    ((OpenGLRenderer) m_pkRenderer).GetCanvas().addMouseMotionListener(this);

    String kExternalDirs = getExternalDirs();
    ImageCatalog.SetActive(new ImageCatalog("Main", kExternalDirs));
    VertexProgramCatalog.SetActive(new VertexProgramCatalog("Main", kExternalDirs));
    PixelProgramCatalog.SetActive(new PixelProgramCatalog("Main", kExternalDirs));
    CompiledProgramCatalog.SetActive(new CompiledProgramCatalog());
  }
  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();
  }