summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-06-16 16:23:03 +0200
committerMichael Bien <[email protected]>2010-06-16 16:23:03 +0200
commit40d4bec71f77184eb4e8f2c9e84536c0149d2e6d (patch)
tree3dfd0096b356fcdabefac86c76dcd3b9bff6dfc0
parentc72028bf7d23378393d1ed5a8e6d5a00ac2a38f8 (diff)
added GLProfile.initSingleton() to GL-CL demos (see JOGL Multithreading doc).
-rw-r--r--src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java11
-rw-r--r--src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java1
-rw-r--r--src/com/jogamp/opencl/demos/julia3d/Julia3d.java3
3 files changed, 12 insertions, 3 deletions
diff --git a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
index 84f129d..f9bb7cd 100644
--- a/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
+++ b/src/com/jogamp/opencl/demos/fractal/MultiDeviceFractal.java
@@ -141,7 +141,7 @@ public class MultiDeviceFractal implements GLEventListener {
private void initCL(GLContext glCtx){
try {
- // SLI on NV platform wasn't very fast (or did not work at all)
+ // SLI on NV platform wasn't very fast (or did not work at all -> CL_INVALID_OPERATION)
if(CLPlatform.getDefault().getName().toLowerCase().contains("nvidia")) {
clContext = CLGLContext.create(glCtx, CLPlatform.getDefault().getMaxFlopsDevice(GPU));
}else{
@@ -196,8 +196,14 @@ public class MultiDeviceFractal implements GLEventListener {
} catch (IOException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "can not find 'Mandelbrot.cl' in classpath.", ex);
+ if(clContext != null) {
+ clContext.release();
+ }
} catch (CLException ex) {
- Logger.getLogger(getClass().getName()).log(Level.SEVERE, "something went wrong, hopefully no one got hurt", ex);
+ Logger.getLogger(getClass().getName()).log(Level.SEVERE, "something went wrong, hopefully nobody got hurt", ex);
+ if(clContext != null) {
+ clContext.release();
+ }
}
}
@@ -521,6 +527,7 @@ public class MultiDeviceFractal implements GLEventListener {
}
public static void main(String args[]) {
+ GLProfile.initSingleton();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new MultiDeviceFractal(512, 512);
diff --git a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
index 3abe1de..8a0d018 100644
--- a/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
+++ b/src/com/jogamp/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java
@@ -274,6 +274,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener {
public void dispose(GLAutoDrawable drawable) { }
public static void main(String[] args) {
+ GLProfile.initSingleton();
new GLCLInteroperabilityDemo();
}
diff --git a/src/com/jogamp/opencl/demos/julia3d/Julia3d.java b/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
index f4bf392..4216af8 100644
--- a/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
+++ b/src/com/jogamp/opencl/demos/julia3d/Julia3d.java
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
+import javax.media.opengl.GLProfile;
import javax.swing.SwingUtilities;
import static com.jogamp.opencl.CLMemory.Mem.*;
@@ -188,7 +189,7 @@ public class Julia3d {
public static void main(String[] args) {
-
+ GLProfile.initSingleton();
RenderingConfig config = RenderingConfig.create()
.setWidth(640).setHeight(480)
.setEnableShadow(1)