From 446e292511a2315702ba608a082ac3a66154c1a8 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 27 Mar 2010 03:05:12 +0100 Subject: refactoring due to gluegen changes. - renamed com.sun.gluegen.runtime -> com.jogamp.gluegen.runtime. --- .../opencl/demos/fractal/MultiDeviceFractal.java | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/com/mbien/opencl/demos/fractal/MultiDeviceFractal.java') diff --git a/src/com/mbien/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/mbien/opencl/demos/fractal/MultiDeviceFractal.java index 5c89ad8..6732a79 100644 --- a/src/com/mbien/opencl/demos/fractal/MultiDeviceFractal.java +++ b/src/com/mbien/opencl/demos/fractal/MultiDeviceFractal.java @@ -9,6 +9,7 @@ import com.mbien.opencl.CLException; import com.mbien.opencl.gl.CLGLBuffer; import com.mbien.opencl.gl.CLGLContext; import com.mbien.opencl.CLKernel; +import com.mbien.opencl.CLPlatform; import com.mbien.opencl.CLProgram; import com.mbien.opencl.CLProgram.CompilerOptions; import com.sun.opengl.util.awt.TextRenderer; @@ -37,7 +38,7 @@ import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.SwingUtilities; -import static com.sun.gluegen.runtime.BufferFactory.*; +import static com.jogamp.gluegen.runtime.BufferFactory.*; import static javax.media.opengl.GL2.*; import static com.mbien.opencl.CLMemory.Mem.*; import static com.mbien.opencl.CLEvent.ProfilingCommand.*; @@ -115,28 +116,34 @@ public class MultiDeviceFractal implements GLEventListener { public void init(GLAutoDrawable drawable) { - // enable GL error checking using the composable pipeline - drawable.setGL(new DebugGL2(drawable.getGL().getGL2())); + if(clContext == null) { + // enable GL error checking using the composable pipeline + drawable.setGL(new DebugGL2(drawable.getGL().getGL2())); - drawable.getGL().glFinish(); - initCL(drawable.getContext()); + drawable.getGL().glFinish(); + initCL(drawable.getContext()); - GL2 gl = drawable.getGL().getGL2(); + GL2 gl = drawable.getGL().getGL2(); - gl.setSwapInterval(0); - gl.glDisable(GL_DEPTH_TEST); - gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + gl.setSwapInterval(0); + gl.glDisable(GL_DEPTH_TEST); + gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - initView(gl, drawable.getWidth(), drawable.getHeight()); + initView(gl, drawable.getWidth(), drawable.getHeight()); - initPBO(gl); - setKernelConstants(); + initPBO(gl); + drawable.getGL().glFinish(); + + setKernelConstants(); + } } private void initCL(GLContext glCtx){ try { // create context managing all available GPUs - clContext = CLGLContext.create(glCtx, GPU); +// clContext = CLGLContext.create(glCtx, GPU); + clContext = CLGLContext.create(glCtx, CLPlatform.getDefault().listCLDevices()[0]); + CLDevice[] devices = clContext.getDevices(); -- cgit v1.2.3