我很难在 Firefox 中运行我的 PApplet。
这是我的代码:
import processing.core.*;
import processing.data.*;
import saito.objloader.*;
import processing.opengl.*;
import java.applet.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.*;
public class load_and_rotate_3d extends PApplet {
OBJModel model;
float rotateX;
float rotateY;
public void setup() {
size(800, 600, OPENGL);
model = new OBJModel(this, "Human Heart.obj", "relative", POLYGON);
model.translateToCenter();
model.scale(15);
noStroke();
}
public void draw() {
background(255);
lights();
translate(width/2, height/2, 0);
rotateX(rotateY);
rotateY(rotateX);
model.draw();
}
public void mouseDragged() {
rotateX += (mouseX - pmouseX) * 0.01f;
rotateY -= (mouseY - pmouseY) * 0.01f;
}
boolean drawLines = false;
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "load_and_rotate_3d" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}
这是html:
<html>
<head>
<title>PApplet</title>
</head>
<body>
<applet code="load_and_rotate_3d.java" codebase = "../source" width="800" height="600">
</applet>
</body>
</html>
环境:Windows7。
代码是在处理中编写的,然后导出到 Eclipse。当我在 mozilla 中打开它时,或者我得到 NoClassDefFoundError 异常。
提前致谢!