Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /nyar4psg/trunk/examples/nonBeginSequence/nonBeginSequence.pde

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1158 - (hide annotations) (download)
Tue Jan 6 07:38:11 2015 UTC (9 years, 3 months ago) by nyatla
File size: 1201 byte(s)
パッケージ構成をProcessing2.0向けに更新

1 nyatla 1158 /**
2     NyARToolkit for proce55ing/1.0.0
3     (c)2008-2011 nyatla
4     airmail(at)ebony.plala.or.jp
5    
6     begin-endシーケンスを使わない方法です。processingの行列を直接操作して、
7     マーカ座標系を反映します。
8    
9     This sample is not using "begin-end" sequence.
10     Projection matrix and Modelview matrix are set to processing directly.
11     */
12     import processing.video.*;
13     import jp.nyatla.nyar4psg.*;
14    
15     Capture cam;
16     MultiMarker nya;
17     int cr,cg,cb;
18    
19     void setup() {
20     size(640,480,P3D);
21     colorMode(RGB, 100);
22     println(MultiMarker.VERSION);
23     nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG);
24     nya.addARMarker("patt.hiro",80);//id=0
25     nya.setARPerspective();
26     cam=new Capture(this,640,480);
27     cr=cg=cb=100;
28     cam.start();
29     }
30    
31     int c=0;
32     void draw()
33     {
34     c++;
35     if (cam.available() !=true) {
36     return;
37     }
38     cam.read();
39     nya.detect(cam);
40     background(0);
41     nya.drawBackground(cam);//frustumを考慮した背景描画
42     if(!nya.isExistMarker(0)){
43     return;
44     }
45     nya.setARPerspective();//NyAR projection
46     pushMatrix();
47     setMatrix(nya.getMarkerMatrix(0)); //load Marker matrix
48     fill(cr,cg,cb);
49     translate(0,0,20);
50     box(40);
51     popMatrix();
52     }
53    

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26