diff options
author | Michael Bien <[email protected]> | 2010-05-01 22:52:11 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-05-01 22:52:11 +0200 |
commit | 37401c35717505b79ab203881b86534bb7098ee8 (patch) | |
tree | 338d66ca2d1696cba9d838913150781479af1484 /src/com/jogamp/opencl/demos/julia3d/Renderer.java | |
parent | 2c85c416d85205ab98b33e1a0b0daab32d4d81ff (diff) |
MultiDeviceFractal is now... multi device again.
Julia3d + AMD: Fixed segfault on exit.
minor misc improvements.
Diffstat (limited to 'src/com/jogamp/opencl/demos/julia3d/Renderer.java')
-rw-r--r-- | src/com/jogamp/opencl/demos/julia3d/Renderer.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/demos/julia3d/Renderer.java b/src/com/jogamp/opencl/demos/julia3d/Renderer.java index ce97e4a..6fe2309 100644 --- a/src/com/jogamp/opencl/demos/julia3d/Renderer.java +++ b/src/com/jogamp/opencl/demos/julia3d/Renderer.java @@ -1,9 +1,13 @@ package com.jogamp.opencl.demos.julia3d; +import com.jogamp.opencl.CLDevice; import com.jogamp.opencl.demos.julia3d.structs.RenderingConfig; import com.jogamp.opengl.util.awt.TextRenderer; import java.awt.Dimension; import java.awt.Font; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import java.nio.FloatBuffer; import java.util.Timer; import java.util.TimerTask; @@ -37,11 +41,11 @@ public class Renderer implements GLEventListener { private TimerTask task; private final Timer timer; - public Renderer(Julia3d julia3d) { + public Renderer(final Julia3d julia3d) { this.julia3d = julia3d; this.config = julia3d.config; - timer = new Timer(); + timer = new Timer(true); juliaSlice = newDirectFloatBuffer(MU_RECT_SIZE * MU_RECT_SIZE * 4); @@ -51,8 +55,16 @@ public class Renderer implements GLEventListener { usi = new UserSceneController(); usi.init(this, canvas, config); - JFrame frame = new JFrame("Java OpenCL - Julia3D GPU"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + CLDevice device = julia3d.getDevice(); + JFrame frame = new JFrame("Java OpenCL - Julia3D "+device.getType()+" "+device.getName()); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + julia3d.release(); + System.exit(0); + } + }); canvas.setPreferredSize(new Dimension(config.getWidth(), config.getHeight())); frame.add(canvas); frame.pack(); |