处理2.2.1没有正确加载obj。文件

时间:2017-02-15 17:20:27

标签: java processing objloader

我在Processing 2.2.1中的程序没有正确显示.obj文件。它看起来像在图片中: preview

目录中有.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();
  }
}

0 个答案:

没有答案