I’m using the Processing library in a simple Java project and I tried to make 3D but I got errors, this is my code :
package fr.ayfri;
import processing.core.PApplet;
import processing.core.PConstants;
public class Main extends PApplet {
public void settings() {
size(1600, 900, PConstants.P3D); // <--- P3D this tells Processing to work with 3D
}
public void draw() {
background(140, 190, 255);
}
public static void main(String[] args) {
String[] processingArgs = { "Main" };
Main main = new Main();
PApplet.runSketch(processingArgs, main);
}
}
But when I run the code I get this error :
java.lang.NoClassDefFoundError: com/jogamp/opengl/GLCapabilitiesImmutable
at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:712)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:569)
at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:35)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at processing.core.PApplet.makeGraphics(PApplet.java:2266)
at processing.core.PApplet.createPrimaryGraphics(PApplet.java:2345)
at processing.core.PApplet.initSurface(PApplet.java:10983)
at processing.core.PApplet.runSketch(PApplet.java:10922)
at fr.ayfri.Main.main(Main.java:20)
Caused by: java.lang.ClassNotFoundException: com.jogamp.opengl.GLCapabilitiesImmutable
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 13 more
java.lang.RuntimeException: com/jogamp/opengl/GLCapabilitiesImmutable
at processing.core.PApplet.makeGraphics(PApplet.java:2299)
at processing.core.PApplet.createPrimaryGraphics(PApplet.java:2345)
at processing.core.PApplet.initSurface(PApplet.java:10983)
at processing.core.PApplet.runSketch(PApplet.java:10922)
at fr.ayfri.Main.main(Main.java:20)
Process finished with exit code 1
//package fr.ayfri;
import processing.core.PApplet;
import processing.core.PConstants;
public class MyProcessingSketch extends PApplet {
public void settings() {
size(200, 200, PConstants.P3D); // <--- P3D this tells Processing to work with 3D
//textSize(64); // Did not like it here!
}
public void draw() {
background(140, 190, 255);
textSize(64);
textAlign(CENTER, CENTER);
text(":)", width/2, height/2 - 10);
}
public static void main(String[] args) {
String[] processingArgs = { "Main" };
MyProcessingSketch main = new MyProcessingSketch();
PApplet.runSketch(processingArgs, main);
}
}
sorry, just realized Hamoid sorted this for you, ill leave this post on though in case its useful to you…
I added this reference code recently. I run it in eclipse. Maybe theres some jars youre missing? If I remember it was just the minim ones you probably dont need unless you want to work with sound.
The framework sets up a JavaFX window and a 3D Processing window. The JavaFX window gives you some way to add controls for your processing sketch so you may not want that. This file is the main processing setup…
Still no luck on my end. I tried a bunch of different jdks, but still getting this error. Seems like P2D and P3D both generate this. I am using Processing 4 with OpenJDK 17.
A fatal error has been detected by the Java Runtime Environment:
SIGILL (0x4) at pc=0x00007fff2017525d, pid=17211, tid=9475
JRE version: OpenJDK Runtime Environment (17.0+35) (build 17+35-2724)
Java VM: OpenJDK 64-Bit Server VM (17+35-2724, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-amd64)
Problematic frame:
C [libdispatch.dylib+0x525d] _dispatch_assert_queue_fail+0x63
No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
An error report file with more information is saved as:
/Users/matthewortega/Documents/GitHub/p5one/hs_err_pid17211.log
If you would like to submit a bug report, please visit:
https://bugreport.java.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)`
Here’s the Sketch:
import processing.core.PApplet;
import processing.core.PConstants;
public class Sketch3 extends PApplet {
public static void main(String[] args) {
PApplet.main(new String[] {Sketch3.class.getName()});
}
@Override
public void settings() {
size(500, 500, PConstants.P3D);
}
@Override
public void setup() {
}
@Override
public void draw() {
}
@Override
public void mousePressed() {
}
@Override
public void keyPressed() {
}
}