diff options
author | Michael Bien <[email protected]> | 2009-12-01 00:50:59 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-12-01 00:50:59 +0100 |
commit | fa7b42cb1b3f9932a07666a8886ef276efb2ddf0 (patch) | |
tree | 79b053dd005af9173e4dd351651455c0113a5119 /src/com/mbien/opencl/demos/joglinterop | |
parent | 927ba4bbd684ad66da1da416562830af58d2cf57 (diff) |
build is now ready to be used in hudson.
updated demos due to api changes.
Diffstat (limited to 'src/com/mbien/opencl/demos/joglinterop')
3 files changed, 15 insertions, 16 deletions
diff --git a/src/com/mbien/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java b/src/com/mbien/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java index 769774c..4581643 100644 --- a/src/com/mbien/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java +++ b/src/com/mbien/opencl/demos/joglinterop/GLCLInteroperabilityDemo.java @@ -34,7 +34,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { private final GLUgl2 glu = new GLUgl2(); private final int MESH_SIZE = 256; - + private int width; private int height; @@ -129,9 +129,9 @@ public class GLCLInteroperabilityDemo implements GLEventListener { gl.setSwapInterval(1); gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); - + gl.glGenBuffers(glObjects.length, glObjects, 0); - + gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, glObjects[INDICES]); gl.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, ib.capacity() * SIZEOF_INT, ib, GL2.GL_STATIC_DRAW); gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0); @@ -141,7 +141,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { gl.glBufferData(GL2.GL_ARRAY_BUFFER, vb.capacity() * SIZEOF_FLOAT, vb, GL2.GL_DYNAMIC_DRAW); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); - + // OpenCL CLProgram program; try { @@ -151,7 +151,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { System.out.println(program.getBuildLog()); System.out.println(program.getBuildStatus()); } catch (IOException ex) { - throw new CLException("can not handle exception", ex); + throw new RuntimeException("can not handle exception", ex); } commandQueue = clContext.getMaxFlopsDevice().createCommandQueue(); @@ -172,7 +172,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); - + compute(gl); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); @@ -185,10 +185,10 @@ public class GLCLInteroperabilityDemo implements GLEventListener { gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]); gl.glVertexPointer(4, GL2.GL_FLOAT, 0, 0); -// gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, glObjects[INDICES]); -// gl.glDrawElements(GL2.GL_POINTS, ib.capacity(), GL2.GL_UNSIGNED_INT, 0); + gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, glObjects[INDICES]); + gl.glDrawElements(GL2.GL_TRIANGLES, ib.capacity(), GL2.GL_UNSIGNED_INT, 0); - gl.glDrawArrays(GL2.GL_POINTS, 0, vb.capacity()/4); +// gl.glDrawArrays(GL2.GL_POINTS, 0, vb.capacity()/4); gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); @@ -255,7 +255,7 @@ public class GLCLInteroperabilityDemo implements GLEventListener { } public void dispose(GLAutoDrawable drawable) { } - + private void deinit() { clContext.release(); System.exit(0); @@ -265,4 +265,4 @@ public class GLCLInteroperabilityDemo implements GLEventListener { new GLCLInteroperabilityDemo(); } -} +}
\ No newline at end of file diff --git a/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl b/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl index cd92f14..5b42eca 100644 --- a/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl +++ b/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl @@ -21,4 +21,3 @@ __kernel void sineWave(__global float4 * vertex, int size, float time) { // write output vertex vertex[y*size + x] = (float4)(u*10.0f, w*10.0f, v*10.0f, 1.0f); } - diff --git a/src/com/mbien/opencl/demos/joglinterop/UserSceneInteraction.java b/src/com/mbien/opencl/demos/joglinterop/UserSceneInteraction.java index ab36f5e..bec2d28 100644 --- a/src/com/mbien/opencl/demos/joglinterop/UserSceneInteraction.java +++ b/src/com/mbien/opencl/demos/joglinterop/UserSceneInteraction.java @@ -16,8 +16,8 @@ import javax.media.opengl.GL2; public class UserSceneInteraction { private float z = -20; - private float rotx; - private float roty; + private float rotx = 45; + private float roty = 30; private Point dragstart; private enum MOUSE_MODE { DRAG_ROTATE, DRAG_ZOOM } @@ -54,7 +54,7 @@ public class UserSceneInteraction { public void mouseWheelMoved(MouseWheelEvent e) { z += e.getWheelRotation()*5; } - + }); component.addMouseListener(new MouseAdapter() { @@ -100,4 +100,4 @@ public class UserSceneInteraction { } -} +}
\ No newline at end of file |