我在处理 2.2.1 中的程序无法正确显示 .obj 文件。它看起来像在图片中:
我在目录中有 .jpg、.obj 和 .mlt 文件,但控制台输出为:
找不到加载文档的方法
这是我的来源:
import saito.objloader.*;
import processing.video.*;
import jp.nyatla.nyar4psg.*;
Capture myCam;
MultiMarker myMarkers;
OBJModel model;
OBJModel model2;
void setup() {
size(1280, 720, P3D);
printArray(Capture.list());
colorMode(RGB, 100);
myCam=new Capture(this, 1280, 720);
myCam.start();
myMarkers=new MultiMarker(this, width, height, "camera_para.dat", NyAR4PsgConfig.CONFIG_PSG);
myMarkers.addARMarker("patt.hiro", 80);
myMarkers.addARMarker("patt.kanji", 80);
model = new OBJModel(this,"earth.obj");
model2 = new OBJModel(this, "kocka.obj");
PImage img0 = loadImage("4096_earth.jpg");
model.setTexture(img0);
model.scale(1);
model.enableDebug();
model.translateToCenter();
model.enableTexture();
model2.scale(1);
model2.translateToCenter();
model2.enableTexture();
}
void draw()
{
if (myCam.available() !=true) {
return;
}
myCam.read();
myMarkers.detect(myCam);
background(0);
myMarkers.drawBackground(myCam);
for (int i=0; i<2; i++) {
if ((!myMarkers.isExistMarker(i))) {
continue;
}
myMarkers.beginTransform(i);
translate(0, 0, 20);
scale(0.1);
switch(i) {
case 0:
model.draw();
break;
case 1:
model2.draw();
break;
}
myMarkers.endTransform();
}
}