Skip to content
Snippets Groups Projects
Commit cc1b5bda authored by Gary Frost's avatar Gary Frost
Browse files

update nobody to work with latest jogl and mac osx

parent 1af60da1
No related merge requests found
......@@ -5,6 +5,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.amd.aparapi"/>
<classpathentry kind="lib" path="jogamp/gluegen-rt.jar"/>
<classpathentry kind="lib" path="jogamp/jogl.all.jar"/>
<classpathentry kind="lib" path="/Users/garyfrost/aparapi/aparapi/trunk/examples/nbody/jogamp/jogl-all.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
......@@ -3,7 +3,6 @@
<project name="nbody" default="build" basedir=".">
<!--<property name="jogamp-jar-url" value="http://jogamp.org/deployment/archive/rc/gluegen_28-joal_17-jogl_41-jocl_25/jar"/>-->
<property name="jogamp-jar-url" value="http://jogamp.org/deployment/archive/rc/gluegen_52-joal_32-jogl_66-jocl_41/jar"/>
<path id="compiler.class.path">
<pathelement path="../../com.amd.aparapi/dist/aparapi.jar"/>
<pathelement path="jogamp/jogl-all.jar"/>
......
......@@ -68,6 +68,7 @@ import com.amd.aparapi.ProfileInfo;
import com.amd.aparapi.Range;
import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
/**
......@@ -198,9 +199,11 @@ public class Main {
public static int height;
public static boolean running;
static Texture texture;
public static void main(String _args[]) {
//System.load("/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/libawt.dylib");
//System.load("/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/libjawt.dylib");
final NBodyKernel kernel = new NBodyKernel(Range.create(Integer.getInteger("bodies", 8192)));
final JFrame frame = new JFrame("NBody");
......@@ -276,7 +279,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);
......@@ -324,12 +328,26 @@ public class Main {
final GL2 gl = drawable.getGL().getGL2();
gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
gl.glEnable(GL.GL_BLEND);
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.enable(gl);
TextureData data = TextureIO.newTextureData(profile,textureStream, false, "jpg");
texture = TextureIO.newTexture(data);
//final Texture texture = TextureIO.newTexture(textureStream, false, null);
// texture.enable(gl);
// texture.bind(gl);
// 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);
// gl.glBindTexture(GL.GL_TEXTURE_2D, texture.);
} catch (final IOException e) {
e.printStackTrace();
} catch (final GLException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment