问题描述
我写在处理
上Raspberrypi(Raspbian)一个程序,导入 3D STL影像
文件。它完美地工作在微软(Windows7的)及Linux操作系统(Ubuntu的)平台,但我在努力的Raspberrypi(Raspbian)平台上运行相同的程序。
我收到以下错误处尺寸(600600,P3D)
当我在Raspberrypi运行这个程序...
进口toxi.geom *。
进口toxi.geom.mesh *。
进口toxi.processing *。
TriangleMesh网;
ToxiclibsSupport GFX;
无效设置(){
尺寸(600600,P3D);
目=(TriangleMesh)新STLReader()loadBinary(sketchPath(check.stl),STLReader.TRIANGLEMESH)。
GFX =新ToxiclibsSupport(本);
}
无效的draw(){
背景(51);
灯();
平移(宽度/ 2,高度/ 2,0);
rotateX(mouseY的* 0.01);
rotateY(mouseX * 0.01);
gfx.origin(新Vec3D(),200);
noStroke();
gfx.mesh(网格,假的,10);
}
java.lang.NoClassDefFoundError的:使用javax /媒体/ OpenGL的/ GLException
在processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
在processing.opengl.PGraphicsOpenGL< INIT>(PGraphicsOpenGL.java:518)
在processing.opengl.PGraphics3D< INIT>(PGraphics3D.java:37)
在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
在java.lang.reflect.Constructor.newInstance(Constructor.java:526)
在processing.core.PApplet.makeGraphics(PApplet.java:1919)
在processing.core.PApplet.size(PApplet.java:1771)
在processing.core.PApplet.size(PApplet.java:1742)
在project5.setup(project5.java:27)
在processing.core.PApplet.handleDraw(PApplet.java:2361)
在processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
在processing.core.PApplet.run(PApplet.java:2256)
在java.lang.Thread.run(Thread.java:724)
致:抛出java.lang.ClassNotFoundException:javax.media.opengl.GLException
在java.net.URLClassLoader的$ 1.运行(URLClassLoader.java:366)
在java.net.URLClassLoader的$ 1.运行(URLClassLoader.java:355)
在java.security.AccessController.doPrivileged(本机方法)
在java.net.URLClassLoader.findClass(URLClassLoader.java:354)
在java.lang.ClassLoader.loadClass(ClassLoader.java:424)
在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)
在java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 15更多
与处理的问题是,目前还没有3D的实现,因为树莓派需要一个OPENGL_ES渲染器。目前,你只能渲染2D(如尺寸(200,200,Java2D的);
)。
其实是有一个 OPENGL_ES渲染器在处理,但它是为Android模式,它在Android SDK的依赖关系。据我所知,没有任何处理OPENGL_ES渲染器,你可以在瞬间对树莓派使用(如果有人知道的一个,请让我知道)。从理论上讲怎么过,就应该可以去掉从Android PGraphics类android的相关性,但感觉就像一个冒险的举动(特别是如果你有一个时间紧迫)。为了开始,你可能想看看 EGL
在Rasperry皮java的运行。
我会建议使用了openFrameworks 反而在这种情况下,如果显示STL文件是你所需要的。我已经为OpenFramworks修改了现有STL插件,并对其进行了测试:性能是伟大的树莓派。虽然这是C ++,该项目是由加工启发和大量的功能将声音非常熟悉。
在你设置OpenFramworks你可以下载 ofxSTLModel 并编译示例(我已经更新它运行对树莓PI)。 preSS任意键来切换线框图。
更新现在有一个实验Raspian图像包括处理3与3D的支持。请查看这个线程
I am writing a program in Processing
on Raspberrypi(Raspbian), to import a 3D STL image
file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform.
I am getting below Error at size(600,600,P3D)
when I run this program on Raspberrypi...
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.processing.*;
TriangleMesh mesh;
ToxiclibsSupport gfx;
void setup() {
size(600,600,P3D);
mesh=(TriangleMesh)new STLReader().loadBinary(sketchPath("check.stl"),STLReader.TRIANGLEMESH);
gfx=new ToxiclibsSupport(this);
}
void draw() {
background(51);
lights();
translate(width/2,height/2,0);
rotateX(mouseY*0.01);
rotateY(mouseX*0.01);
gfx.origin(new Vec3D(),200);
noStroke();
gfx.mesh(mesh,false,10);
}
java.lang.NoClassDefFoundError: javax/media/opengl/GLException
at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at processing.core.PApplet.makeGraphics(PApplet.java:1919)
at processing.core.PApplet.size(PApplet.java:1771)
at processing.core.PApplet.size(PApplet.java:1742)
at project5.setup(project5.java:27)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 15 more
The issue with Processing is that currently there is no 3D implementation because Raspberry PI needs an OPENGL_ES renderer.Currently you can only render in 2D (e.g. size(200,200,JAVA2D);
).
There is actually an OPENGL_ES renderer in Processing but it's for the Android mode and it has dependencies on the android SDK. As far as I know, there isn't any Processing OPENGL_ES renderer you can use on Raspberry PI at the moment(if someone knows of one, please let me know). In theory how ever, it should be possible to strip out the android dependencies from the Android PGraphics class, but feels like a risky move (especially if you have a tight deadline).To get started you may want to look EGL
in java running on Rasperry Pi.
I would recommend using OpenFrameworks instead in this case, if displaying an STL file is all you need. I've modified an existing STL addon for OpenFramworks and tested it: the performance is great on the Raspberry PI. Although it's c++, the project is inspired by Processing and a lot of the functions will sound very familiar.
Once you setup OpenFramworks you can download ofxSTLModel and compile the example(I've updated it to run on Raspberry PI). Press any key to toggle wireframe view.
UpdateNow there is an experimental Raspian image including Processing 3 with 3D support. Check out this thread
这篇关于java.lang.NoClassDefFoundError的:使用javax /媒体/ OpenGL的/ GLException在processing.opengl.PGraphicsOpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!