public void display(GLAutoDrawable drawable) {
   GL gl = drawable.getGL();
   synchronized (this._camera) {
     try {
       gl.glClear(
           GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame.
       NyARGLDrawUtil.drawBackGround(gl, this._camera.getSourceImage(), 1.0);
       this._nyar.update(this._camera);
       if (this._nyar.isExistMarker(this.ids[0])) {
         gl.glMatrixMode(GL.GL_MODELVIEW);
         gl.glPushMatrix();
         gl.glLoadMatrixd(this._nyar.getGlMarkerMatrix(this.ids[0]), 0);
         NyARGLDrawUtil.drawColorCube(gl, 40);
         gl.glPopMatrix();
       }
       if (this._nyar.isExistMarker(this.ids[1])) {
         gl.glMatrixMode(GL.GL_MODELVIEW);
         gl.glPushMatrix();
         gl.glLoadMatrixd(this._nyar.getGlMarkerMatrix(this.ids[1]), 0);
         NyARGLDrawUtil.drawColorCube(gl, 40);
         gl.glPopMatrix();
       }
       Thread.sleep(1);
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
 public void init(GLAutoDrawable drawable) {
   GL gl = drawable.getGL();
   gl.glMatrixMode(GL.GL_PROJECTION);
   gl.glLoadMatrixd(this._nyar.getGlProjectionMatrix(), 0);
   gl.glEnable(GL.GL_DEPTH_TEST);
   gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   Animator animator = new Animator(drawable);
   animator.start();
   return;
 }
示例#3
0
  public void init(GLAutoDrawable drawable) {
    this._gl = drawable.getGL();
    this._gl.glEnable(GL.GL_DEPTH_TEST);
    NyARGLDrawUtil.setFontStyle("SansSerif", Font.BOLD, 36);
    NyARGLDrawUtil.setFontColor(Color.RED);
    this._gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    // NyARToolkitの準備
    try {
      // プロセッサの準備
      this._processor =
          new MarkerProcessor(this._ar_param, this._cap_image.getBufferType(), this._glnya);
      this._processor.setARCodeTable(_code_table, 16, 80.0);

      // カメラパラメータの計算
      NyARGLUtil.toCameraFrustumRH(this._ar_param, 1.0, 10, 10000, this._camera_projection);
      // キャプチャ開始
      this._capture.start();
    } catch (Exception e) {
      e.printStackTrace();
    }
    this._animator = new Animator(drawable);
    this._animator.start();
    return;
  }
 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
   GL gl = drawable.getGL();
   gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
   gl.glViewport(0, 0, width, height);
   return;
 }