From c72028bf7d23378393d1ed5a8e6d5a00ac2a38f8 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 6 Jun 2010 23:56:28 +0200 Subject: fixed resizing of fractal demo. --- .../jogamp/opencl/demos/fractal/MultiDeviceFractal.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/com/jogamp/opencl') diff --git a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java index 1b7f19d..84f129d 100644 --- a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java +++ b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java @@ -17,6 +17,7 @@ import com.jogamp.opengl.util.awt.TextRenderer; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; +import java.awt.Frame; import java.awt.Point; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -36,7 +37,6 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; -import javax.swing.JFrame; import javax.swing.SwingUtilities; import static com.jogamp.common.nio.Buffers.*; @@ -104,8 +104,8 @@ public class MultiDeviceFractal implements GLEventListener { canvas.addGLEventListener(this); initSceneInteraction(); - JFrame frame = new JFrame("JOCL Multi Device Mandelbrot Set"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + Frame frame = new Frame("JOCL Multi Device Mandelbrot Set"); +// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvas.setPreferredSize(new Dimension(width, height)); frame.add(canvas); frame.pack(); @@ -355,9 +355,9 @@ public class MultiDeviceFractal implements GLEventListener { // OpenCL private void compute() { - int sliceWidth = width / slices; - double rangeX = (maxX - minX) / slices; - double rangeY = (maxY - minY); + int sliceWidth = (int)(width / (float)slices); + double rangeX = (maxX - minX) / slices; + double rangeY = (maxY - minY); // release all old events, you can't reuse events in OpenCL probes.release(); @@ -432,8 +432,10 @@ public class MultiDeviceFractal implements GLEventListener { this.height = height; initPBO(drawable.getGL()); + setKernelConstants(); - initView(drawable.getGL().getGL2(), drawable.getWidth(), drawable.getHeight()); + initView(drawable.getGL().getGL2(), width, height); + } private void initSceneInteraction() { -- cgit v1.2.3