コード例 #1
0
 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();
     }
   }
 }
コード例 #2
0
  public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {

    _gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    _gl.glViewport(0, 0, width, height);

    // 視体積の設定
    _gl.glMatrixMode(GL.GL_PROJECTION);
    _gl.glLoadIdentity();
    // 見る位置
    _gl.glMatrixMode(GL.GL_MODELVIEW);
    _gl.glLoadIdentity();
  }
コード例 #3
0
ファイル: Teste.java プロジェクト: mhadaniya/3cop005
  public void display(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT);

    gl.glRasterPos2i(1, 1);
    gl.glDrawPixels(
        dim.width,
        dim.height, //
        GL.GL_RGB,
        GL.GL_UNSIGNED_BYTE,
        pixels);

    gl.glFlush();
  }
コード例 #4
0
ファイル: Portal.java プロジェクト: ChaplinWang/Graphics
  private void renderOneside(Point2D a, Point2D b, GL gl, double d) {
    gl.glClear(0);
    Vector3D t = new Vector3D(b.x - a.x, 0, b.y - a.y);
    Vector3D n = new Vector3D(0, 1, 0);
    Vector3D cross = n.cross(t);
    gl.glNormal3d(cross.x, cross.y, cross.z);

    // Texture adjustment vars
    double length =
        scale * Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) / 100 + 0.1;
    double height = scale;

    // draw the 4 points of it
    gl.glBegin(GL.GL_POLYGON);
    gl.glTexCoord2d(0, 0);
    gl.glVertex3d(a.x, d, a.y);
    gl.glTexCoord2d(0, height);
    gl.glVertex3d(a.x, d + 100, a.y);
    gl.glTexCoord2d(length, height);
    gl.glVertex3d(b.x, d + 100, b.y);
    gl.glTexCoord2d(length, 0);
    gl.glVertex3d(b.x, d, b.y);
    gl.glEnd();
  }
コード例 #5
0
 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;
 }