From 317f2880296aa346501a0d6cf23b8ff18d8d4bf1 Mon Sep 17 00:00:00 2001 From: Gary Frost <frost.gary@gmail.com> Date: Sat, 22 Dec 2012 16:24:25 +0000 Subject: [PATCH] A few tweeks to make run on Mac OSX --- .../com/amd/aparapi/examples/oopnbody/Main.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/oopnbody/src/com/amd/aparapi/examples/oopnbody/Main.java b/examples/oopnbody/src/com/amd/aparapi/examples/oopnbody/Main.java index 307701ca..411282cb 100644 --- a/examples/oopnbody/src/com/amd/aparapi/examples/oopnbody/Main.java +++ b/examples/oopnbody/src/com/amd/aparapi/examples/oopnbody/Main.java @@ -211,11 +211,13 @@ public class Main { public static boolean running; + public static Texture texture = null; + public static void main(String _args[]) { - int bodyCount = Integer.getInteger("bodies", 8192); + final int bodyCount = Integer.getInteger("bodies", 8192); //final Main kernel = new Main(bodyCount); - final NBodyKernel kernel = new NBodyKernel(Range.create(Integer.getInteger("bodies", 8192))); + final NBodyKernel kernel = new NBodyKernel(Range.create(bodyCount)); final JFrame frame = new JFrame("NBody"); @@ -290,7 +292,8 @@ public class Main { public void display(GLAutoDrawable drawable) { final GL2 gl = drawable.getGL().getGL2(); - + texture.enable(gl); + texture.bind(gl); gl.glLoadIdentity(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glColor3f(1f, 1f, 1f); @@ -331,9 +334,13 @@ public class Main { gl.glShadeModel(GLLightingFunc.GL_SMOOTH); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE); + + gl.glEnable(GL.GL_TEXTURE_2D); + gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); + gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); try { final InputStream textureStream = Main.class.getResourceAsStream("particle.jpg"); - final Texture texture = TextureIO.newTexture(textureStream, false, null); + texture = TextureIO.newTexture(textureStream, false, null); texture.enable(gl); } catch (final IOException e) { e.printStackTrace(); -- GitLab