简体   繁体   中英

Eclipse and Java 3D error null graphics configuration

I am trying to set up Java 3D with eclipse, but I continue to get this error

Exception in thread "main" java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration
at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:963)
at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1006)
at hellouniverse.LA.<init>(LA.java:54)
at hellouniverse.LA.main(LA.java:73)

Im not sure how to fix this or what to do.

Old question, but I've come through it today. Extracted from this website :

Don't declare the Canvas3D object with null value.

Canvas3D canvas = new Canvas3D(null);

Instead pass the GraphicsConfiguration parameter:

GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM