/** ***************************************************** */
  public void draw(GL2 gl, GLU glu, Camera cam) {
    if (transform != null) transform.execute(gl);
    gl.glTranslatef(x, y, z);

    applyMaterial(gl);
    gl.glLineWidth(wfwidth);

    // Draw
    GLUquadric qobj = glu.gluNewQuadric();

    if (facestatus) {
      if (wfstatus) {
        gl.glEnable(GL2.GL_POLYGON_OFFSET_FILL);
        gl.glPolygonOffset(1.0f, 1.0f);
      }

      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(color.r, color.g, color.b, color.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);

      if (wfstatus) gl.glDisable(GL2.GL_POLYGON_OFFSET_FILL);
    }
    if (wfstatus) {
      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
      gl.glNormal3f(norm.x, norm.y, norm.z);
      gl.glColor4f(wfcolor.r, wfcolor.g, wfcolor.b, wfcolor.a);
      glu.gluDisk(qobj, radiusInner, radiusOuter, slices, loops);
    }
  }
  public void draw() {

    GL2 gl = getGL2();

    pushMatrix();

    translate(0, 0, -2);
    rotate(view_rotx, 1.0, 0.0, 0.0);
    rotate(view_roty, 0.0, 1.0, 0.0);
    rotate(view_rotz, 0.0, 0.0, 1.0);
    translate(0, 0, 2);

    if (app != null) {
      if (is_playing) {
        map_previous = map;
        map =
            new DepthMap(
                app.w,
                app.h,
                DepthMap.fromRawDepthFile(
                    new File(app.filename), app.frame_now - 1, app.w, app.h, false));
        map.maskZ(app.z_threshold.getValue() / 100f);
        // map.maskRect(130,40,100,100);//head
        // map.maskRect(50,140,130,100);//arms
        map.setUVuniform();
        if (app.frame_now < app.frames) {
          app.frame_now += 1;
          app.time_domain.setValue(app.frame_now);
        } else {
          app.play_button.setText("Play");
          stop();
        }
      }
    }

    if (map != null) {
      if (app.show_diff.isSelected() && map != null && map_previous != null) {

        // map.drawNormals(gl);

        // gl.glClear(GL2.GL_DEPTH);
        // gl.glEnable(GL2.GL_BLEND);

        computeColorMap();
        gl.glDisable(GL2.GL_LIGHTING);
        gl.glEnable(GL2.GL_TEXTURE_2D);
        gl.glColor4f(1f, 1f, 1f, 0.75f);
        video_frame.use(gl);
        map.drawTextureNormals(gl);
        gl.glDisable(GL2.GL_TEXTURE_2D);
        gl.glEnable(GL2.GL_LIGHTING);
        gl.glDisable(GL2.GL_BLEND);
      } else {
        gl.glColor3f(0.9f, 0.9f, 0.9f);
        map.drawNormals(gl);
      }
    }

    popMatrix();
  }
Example #3
0
  /**
   * Render the arrow as a line and a _head.
   *
   * @param gl OpenGL Context
   */
  public void render(GL2 gl) {
    // save Light Attributes and remove lighting to get "full" RGB colors
    // gl.glPushAttrib( GL2.GL_LIGHTING_BIT );
    gl.glPushAttrib(GL2.GL_ENABLE_BIT);
    gl.glDisable(GL2.GL_LIGHTING);

    if (_fg_verb) {
      System.out.println(
          "Arrow pos="
              + _pos.toString()
              + "  angZ1="
              + _angZ1
              + "  angY2="
              + _angY2
              + "  length="
              + _length);
      _fg_verb = false;
    }

    // save transformation matrix, then translate and scale.
    gl.glPushMatrix();
    gl.glTranslatef(_pos.x, _pos.y, _pos.z);
    gl.glRotatef(Matrix.rad2Deg(_angZ1), 0, 0, 1); // rotation around 0z
    gl.glRotatef(Matrix.rad2Deg(_angY2), 0, 1, 0); // rotation around 0y

    // draw line
    gl.glColor4f(_color_fg.x, _color_fg.y, _color_fg.z, _color_fg.w);
    gl.glLineWidth(1.0f);
    gl.glBegin(GL.GL_LINES);
    {
      gl.glVertex3f(0, 0, 0);
      gl.glVertex3f(_length, 0, 0);
    }
    gl.glEnd();

    // draw head
    gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL);
    gl.glTranslatef(_length, 0, 0);
    gl.glBegin(GL.GL_TRIANGLES);
    {
      for (float[] face : _head_faces) {
        gl.glVertex3f(face[0], face[1], face[2]);
        gl.glVertex3f(face[3], face[4], face[5]);
        gl.glVertex3f(face[6], face[7], face[8]);
      }
    }
    gl.glEnd();

    // restore transformation matrix
    gl.glPopMatrix();
    // restore attributes
    gl.glPopAttrib();
  }
  @Override
  public void display(GLAutoDrawable drawable) {
    GL2 gl = drawable.getGL().getGL2();

    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity();

    // Move camera back a little
    gl.glTranslated(0, 0, -1);

    // Forgetting to clear the depth buffer can cause problems
    // such as empty black screens.
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);

    gl.glBegin(GL2.GL_TRIANGLES);
    {

      // Need to draw transparent one last
      gl.glColor4f(1f, 0f, 0f, 0.75f); // try with 0.25
      // CCW ordering of vertices
      double p0[] = {1, 0, -1};
      double p1[] = {0, 1, -1};
      double p2[] = {-1, 0, -1};

      // Can pass in an array and an offset into the array
      gl.glVertex3dv(p0, 0);
      gl.glVertex3dv(p1, 0);
      gl.glVertex3dv(p2, 0);

      // Opaque one (at back) must be drawn before
      // transparent one in front
      gl.glColor4f(0, 1, 0, 1f);
      gl.glVertex3d(2, 0, -2);
      gl.glVertex3d(1, 1, -2);
      gl.glVertex3d(0, 0, -2);
    }
    gl.glEnd();
  }
Example #5
0
  public void drawTextureToOffScreenTexture(int texId, int attachment)
        // public void drawTextureToOffScreenTextureUsingShader(Texture tex, int attachment, Program
        // program)
      {
    GL2 gl = getGL();

    // program.bind(gl);

    gl.glBindTexture(GL_TEXTURE_2D, texId);
    // gl.glBindTexture(GL_TEXTURE_2D, tex.getTextureObject());
    // gl.glDrawBuffer(attachment);
    gl.glBindFramebuffer(GL_FRAMEBUFFER, attachment); // think this is the new way...

    gl.glEnable(GL_TEXTURE_2D);
    // gl.glActiveTexture(GL_TEXTURE0);
    gl.glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

    gl.glViewport(0, 0, fboWidth, fboHeight);

    // gl.glUniform1i(program.uniform("theTexture"), 0);
    // set projection to ortho
    gl.glMatrixMode(GL_PROJECTION);
    gl.glTranslatef(1f, 1f, 1f);

    gl.glPushMatrix();
    {
      gl.glLoadIdentity();
      RenderUtils.getGLU().gluOrtho2D(0, fboWidth, fboHeight, 0);

      gl.glMatrixMode(gl.GL_MODELVIEW);

      gl.glPushMatrix();
      {
        gl.glLoadIdentity();

        gl.glColor4f(1f, 1f, 1f, 1f);
        drawSquare(gl, 0, 0, fboWidth, fboHeight);
      }
      gl.glPopMatrix();

      gl.glMatrixMode(gl.GL_PROJECTION);
    }
    gl.glPopMatrix();

    gl.glMatrixMode(gl.GL_MODELVIEW);

    gl.glDisable(GL_TEXTURE_2D);
    // program.unbind(gl);
  }
Example #6
0
 public void renderSelection(GL2 g) {
   if ((Globals.tab == Tab.labels || Globals.tab == Tab.height)) {
     g.glDisable(GL2.GL_ALPHA_TEST);
     g.glEnable(GL2.GL_BLEND);
     g.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
     double color = System.currentTimeMillis();
     color %= 2000d;
     color -= 1000d;
     color = Math.abs(color);
     color /= 1000d;
     g.glColor4d(1, 1, 0, 0.1d + 0.2d * color);
     g.glBegin(GL2.GL_QUADS);
     g.glVertex2f(0, 0);
     g.glVertex2f(0, 4);
     g.glVertex2f(4, 4);
     g.glVertex2f(4, 0);
     g.glEnd();
     g.glColor4f(1, 1, 1, 1);
     g.glDisable(GL2.GL_BLEND);
     g.glEnable(GL2.GL_ALPHA_TEST);
   }
 }
Example #7
0
  public void draw(GL2 gl, GLU glu, GLDrawState ds) {
    final Color4f highColor = new Color4f(0.0f, 1.0f, 0.0f, 1.0f);
    final Color4f lowColor = new Color4f(1.0f, 1.0f, 1.0f, 1.0f);

    Color4f[][] trueCols = new Color4f[mapHeight][mapWidth];
    //		InternalTerrainTile tiles[][] = ds.getGameMap().getTerrainMatrix();
    // Update colors

    for (int j = 0; j < mapHeight; j++) {
      for (int i = 0; i < mapWidth; i++) {

        // float fluxAmount = getMapHeight(i, j)/64.f;
        //	System.out.println(flux[j/DENSITY][i/DENSITY] + " " + fluxAmount);

        // float fluxAmount = (float)tiles[i/DENSITY][j/DENSITY].getFlux();

        Color4f tintColor = new Color4f();
        Color4f trueColor = new Color4f();

        tintColor.interpolate(lowColor, highColor, 0);
        // System.out.println(actualHeight/maxHeight);

        trueColor.interpolate(cols[j][i], tintColor, 1.0f);
        trueColor.w = cols[j][i].w;
        trueCols[j][i] = trueColor;

        // If void, see through to the background.
        /*if(tiles[i/DENSITY][j/DENSITY] == TerrainType.VOID){
        trueCols[j][i].w = 0.0f;
        }*/

      }
    }
    // System.out.println(map.getTerrainMatrix()[0][0].getFlux() + " " + MAX_FLUX_PER_TILE + " " +
    // trueCols[0][0].x);

    int k = 0;
    for (int j = 0; j < mapHeight; j++) {
      for (int i = 0; i < mapWidth; i++) {
        colors[k] = trueCols[j][i].x;
        colors[k + 1] = trueCols[j][i].y;
        colors[k + 2] = trueCols[j][i].z;
        colors[k + 3] = trueCols[j][i].w;

        float norm =
            (float)
                Math.sqrt(
                    trueCols[j][i].x * trueCols[j][i].x
                        + trueCols[j][i].y * trueCols[j][i].y
                        + trueCols[j][i].z * trueCols[j][i].z);
        float val = (norm < 0.3f) ? 0.0f : 0.9f;
        colorNorm[k] = val;
        colorNorm[k + 1] = val;
        colorNorm[k + 2] = val;
        colorNorm[k + 3] = 1.0f;
        k += 4;
      }
    }

    if (tex == null && texturePath != null) {
      tex = GLGameRenderer.textureCache.getResource(texturePath, texturePath).tex;
      texturePath = null;
    }
    gl.glPushMatrix();
    //	gl.glTranslatef(1.5f, 0.0f, 1.5f);
    if (tex != null) {
      System.out.println("Using texture");
      gl.glEnable(GL2.GL_TEXTURE_2D);
      tex.bind(gl);
      gl.glBegin(GL2.GL_TRIANGLE_STRIP);
      for (int i = 0; i < indices.length; i++) {
        gl.glTexCoord2f(texCoords[indices[i] * 2], texCoords[indices[i] * 2 + 1]);
        gl.glColor4f(
            colorNorm[indices[i] * 4],
            colorNorm[indices[i] * 4 + 1],
            colorNorm[indices[i] * 4 + 2],
            colorNorm[indices[i] * 4 + 3]);
        gl.glNormal3f(
            normals[indices[i] * 3], normals[indices[i] * 3 + 1], normals[indices[i] * 3 + 2]);
        gl.glVertex3f(
            vertices[indices[i] * 3], vertices[indices[i] * 3 + 1], vertices[indices[i] * 3 + 2]);
      }
      gl.glEnd();
    } else {
      gl.glEnable(gl.GL_BLEND);
      gl.glBegin(GL2.GL_TRIANGLE_STRIP);
      for (int i = 0; i < indices.length; i++) {
        gl.glColor4f(
            colors[indices[i] * 4],
            colors[indices[i] * 4 + 1],
            colors[indices[i] * 4 + 2],
            colors[indices[i] * 4 + 3]);
        gl.glNormal3f(
            normals[indices[i] * 3], normals[indices[i] * 3 + 1], normals[indices[i] * 3 + 2]);
        gl.glVertex3f(
            vertices[indices[i] * 3], vertices[indices[i] * 3 + 1], vertices[indices[i] * 3 + 2]);
      }
      gl.glEnd();
      gl.glDisable(gl.GL_BLEND);
    }
    gl.glPopMatrix();

    boolean showGrid = RenderConfiguration.showGridlines();
    if (showGrid) {
      gl.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
      gl.glNormal3f(0.0f, 1.0f, 0.0f);
      gl.glLineWidth(1.0f);

      // do the horizontal gridlines
      /*
      gl.glBegin(GL2.GL_LINES);
      for (int j = 1; j < map.getHeight(); ++j) {
      	gl.glVertex3f(0.0f, 0.0f, j);
      	gl.glVertex3f(map.getWidth(), 0.0f, j);
      }
      gl.glEnd();
      */
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (int j = 0; j < mapHeight; j++) {
        if ((j + 1) % DENSITY != 0) {
          continue;
        }
        if ((j + 1) % (DENSITY * 2) == 0) {
          for (int i = 0; i < mapWidth; i++) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1 && i > 0) {
              pTwo = points[j + 1][i - 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1) {
              pTwo = points[j + 1][i];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        } else {
          for (int i = mapWidth - 1; i >= 0; i--) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1) {
              pTwo = points[j + 1][i];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j < mapHeight - 1 && i > 0) {

              pTwo = points[j + 1][i - 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        }
      }
      gl.glEnd();

      // do the vertical gridlines
      /*
      gl.glBegin(GL2.GL_LINES);
      for (int j = 1; j < map.getWidth(); ++j) {
      	gl.glVertex3f(j, 0.0f, 0.0f);
      	gl.glVertex3f(j, 0.0f, map.getHeight());
      }
      gl.glEnd();
      */
      gl.glBegin(GL2.GL_LINE_STRIP);
      for (int i = 0; i < mapWidth; i++) {
        if ((i + 1) % DENSITY != 0) {
          continue;
        }
        if ((i + 1) % (DENSITY * 2) == 0) {
          for (int j = 0; j < mapHeight; j++) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j > 0 && i < mapWidth - 1) {
              pTwo = points[j - 1][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (i < mapWidth - 1) {
              pTwo = points[j][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        } else {
          for (int j = mapHeight - 1; j >= 0; j--) {
            Vector3f p;
            Vector3f pOne;
            Vector3f pTwo;

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (i < mapWidth - 1) {
              pTwo = points[j][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);

            pOne = points[j][i];
            p = new Vector3f(0.0f, 0.0f, 0.0f);
            p.add(pOne);
            if (j > 0 && i < mapWidth - 1) {
              pTwo = points[j - 1][i + 1];
              p.add(pTwo);
              p.scale(.5f);
            }

            gl.glVertex3f(p.x, p.y + 0.01f, p.z);
          }
        }
      }
      gl.glEnd();
    }
  }
  public void draw(GL2 gl) {
    if (particles.size() == 0) return;
    switch (blendMode) {
      case 0: // '\0'
        gl.glDisable(3042);
        gl.glDisable(3008);
        break;

      case 1: // '\001'
        gl.glEnable(3042);
        gl.glDisable(3008);
        gl.glBlendFunc(768, 1);
        break;

      case 2: // '\002'
        gl.glEnable(3042);
        gl.glDisable(3008);
        gl.glBlendFunc(770, 1);
        break;

      case 3: // '\003'
        gl.glDisable(3042);
        gl.glEnable(3008);
        break;

      case 4: // '\004'
        gl.glEnable(3042);
        gl.glDisable(3008);
        gl.glBlendFunc(770, 1);
        break;
    }
    gl.glBindTexture(3553, model.mMaterials[texture].mTextureId);
    gl.glPushMatrix();
    if (particleType == 0 || particleType == 2) {
      if ((flags & 0x1000) == 0) {
        Vec3 view = new Vec3(viewer.getCamera().getPosition());
        view.normalize();
        Vec3 right = Vec3.cross(view, new Vec3(0.0F, 0.0F, 1.0F)).normalize();
        Vec3 up = Vec3.cross(right, view).normalize();
        int tcStart = 0;
        if (flags == 0x40019) tcStart++;
        gl.glBegin(7);
        int count = particles.size();
        Vec3 pos = new Vec3();
        Vec3 cPos = new Vec3();
        Vec3 ofs = new Vec3();
        for (int i = 0; i < count; i++) {
          Particle p = (Particle) particles.get(i);
          if (p.tile < texCoords.size()) {
            gl.glColor4f(p.color.x, p.color.y, p.color.z, p.color.w);
            Point2f tc[] = (Point2f[]) texCoords.get(p.tile);
            Vec3.add(right, up, ofs);
            cPos.set(p.pos);
            Vec3.sub(cPos, ofs.scale(p.size), pos);
            gl.glTexCoord2f(tc[tcStart % 4].x, tc[tcStart % 4].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.sub(right, up, ofs);
            Vec3.add(cPos, ofs.scale(p.size), pos);
            gl.glTexCoord2f(tc[(tcStart + 1) % 4].x, tc[(tcStart + 1) % 4].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.add(right, up, ofs);
            Vec3.add(cPos, ofs.scale(p.size), pos);
            gl.glTexCoord2f(tc[(tcStart + 2) % 4].x, tc[(tcStart + 2) % 4].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.sub(right, up, ofs);
            Vec3.sub(cPos, ofs.scale(p.size), pos);
            gl.glTexCoord2f(tc[(tcStart + 3) % 4].x, tc[(tcStart + 3) % 4].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
          }
        }

        gl.glEnd();
      } else {
        gl.glBegin(7);
        int count = particles.size();
        Vec3 pos = new Vec3();
        Vec3 ofs = new Vec3();
        for (int i = 0; i < count; i++) {
          Particle p = (Particle) particles.get(i);
          if (p.tile < texCoords.size()) {
            gl.glColor4f(p.color.x, p.color.y, p.color.z, p.color.w);
            Point2f tc[] = (Point2f[]) texCoords.get(p.tile);
            Vec3.add(p.pos, Vec3.scale(p.corners[0], p.size, ofs), pos);
            gl.glTexCoord2f(tc[0].x, tc[0].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.add(p.pos, Vec3.scale(p.corners[1], p.size, ofs), pos);
            gl.glTexCoord2f(tc[1].x, tc[1].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.add(p.pos, Vec3.scale(p.corners[2], p.size, ofs), pos);
            gl.glTexCoord2f(tc[2].x, tc[2].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
            Vec3.add(p.pos, Vec3.scale(p.corners[3], p.size, ofs), pos);
            gl.glTexCoord2f(tc[3].x, tc[3].y);
            gl.glVertex3f(pos.x, pos.y, pos.z);
          }
        }

        gl.glEnd();
      }
    } else if (particleType == 1) {
      gl.glBegin(7);
      int count = particles.size();
      Vec3 pos = new Vec3();
      Vec3 ofs = new Vec3();
      float f = 1.0F;
      Vec3 bv0 = new Vec3(-f, f, 0.0F);
      Vec3 bv1 = new Vec3(f, f, 0.0F);
      for (int i = 0; i < count; i++) {
        Particle p = (Particle) particles.get(i);
        if (p.tile >= texCoords.size() - 1) break;
        gl.glColor4f(p.color.x, p.color.y, p.color.z, p.color.w);
        Point2f tc[] = (Point2f[]) texCoords.get(p.tile);
        Vec3.add(p.pos, Vec3.scale(bv0, p.size, ofs), pos);
        gl.glTexCoord2f(tc[0].x, tc[0].y);
        gl.glVertex3f(pos.x, pos.y, pos.z);
        Vec3.add(p.pos, Vec3.scale(bv1, p.size, ofs), pos);
        gl.glTexCoord2f(tc[1].x, tc[1].y);
        gl.glVertex3f(pos.x, pos.y, pos.z);
        Vec3.add(p.origin, Vec3.scale(bv1, p.size, ofs), pos);
        gl.glTexCoord2f(tc[2].x, tc[2].y);
        gl.glVertex3f(pos.x, pos.y, pos.z);
        Vec3.add(p.origin, Vec3.scale(bv0, p.size, ofs), pos);
        gl.glTexCoord2f(tc[3].x, tc[3].y);
        gl.glVertex3f(pos.x, pos.y, pos.z);
      }

      gl.glEnd();
    }
    gl.glPopMatrix();
  }
Example #9
0
  public void draw(GL2 gl, Camera camera, Perspective3D perspective3d) {
    Photo photo = this.photo;

    gl.glDisable(GL2.GL_DEPTH_TEST);
    gl.glColor4f(
        (float) 255 / 255, (float) 255 / 255, (float) 255 / 255, (float) photo.getTransparent());

    // Enable Alpha Blending (disable alpha testing)
    gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
    gl.glEnable(GL2.GL_BLEND);

    gl.glDisable(GL2.GL_LIGHTING);
    gl.glEnable(GL2.GL_TEXTURE_2D);

    // XXX
    String textureName = photo.getPath();

    TextureCoords tc = new TextureCoords(0, 0, 1, 1);
    if (textureName != null) {
      Texture texture = this.textureCacheService.getTexture(gl, textureName);

      //            // switch to texture mode and push a new matrix on the stack
      //            gl.glMatrixMode(GL2.GL_TEXTURE);
      //            gl.glPushMatrix();
      //
      //            // check to see if the texture needs flipping
      //            if (texture.getMustFlipVertically()) {
      //                gl.glScaled(1, -1, 1);
      //                gl.glTranslated(0, -1, 0);
      //            }
      //
      //            // switch to modelview matrix and push a new matrix on the stack
      //            gl.glMatrixMode(GL2.GL_MODELVIEW);
      //            gl.glPushMatrix();
      //
      //            // This is required to repeat textures
      //            gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
      //            gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);

      // enable, bind
      texture.enable(gl);
      texture.bind(gl);

      tc = texture.getImageTexCoords();
    }

    gl.glBegin(GL2.GL_POLYGON);
    //        gl.glColor3f((float)123/256, (float)111/256, (float)100/255);
    //        gl.glColor3f((float) 255/255, (float)255/255, (float)255/255);

    LatLon ll = new LatLon(photo.getLat(), photo.getLon());

    Projection proj = Main.getProjection();

    EastNorth eastNorth = proj.latlon2eastNorth(ll);

    double x = perspective3d.calcX(eastNorth.east());
    double y = photo.getHeight();
    double z = -perspective3d.calcY(eastNorth.north());

    Vector3d angle = photo.getRotate();

    double distance = 500d;

    double width = distance * Math.sin(photo.getAngleWitht() / 2d);
    double height = distance * Math.sin(photo.getAngleHeigth() / 2d);

    Vector3d p1 = new Vector3d(distance, -height, -width);
    Vector3d p2 = new Vector3d(distance, -height, width);
    Vector3d p3 = new Vector3d(distance, height, width);
    Vector3d p4 = new Vector3d(distance, height, -width);

    p1 = transform(angle, p1);
    p2 = transform(angle, p2);
    p3 = transform(angle, p3);
    p4 = transform(angle, p4);

    Point3d c = camera.getPoint();

    // gl.glColor4f((float) 255/255, (float)255/255, (float)255/255, (float) 128/255);
    gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_BLEND);

    gl.glTexCoord2d(tc.left(), tc.bottom());
    gl.glVertex3d(p1.x + x, p1.y + y, p1.z + z);
    gl.glTexCoord2d(tc.right(), tc.bottom());
    gl.glVertex3d(p2.x + x, p2.y + y, p2.z + z);
    gl.glTexCoord2d(tc.right(), tc.top());
    gl.glVertex3d(p3.x + x, p3.y + y, p3.z + z);
    gl.glTexCoord2d(tc.left(), tc.top());
    gl.glVertex3d(p4.x + x, p4.y + y, p4.z + z);

    gl.glEnd();

    gl.glColor3f((float) 0 / 255, (float) 0 / 255, (float) 255 / 255);

    gl.glPushMatrix();

    gl.glTranslated(x, 0.1, z);

    gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE);

    DrawUtil.drawDotY(gl, 0.5, 12);
    gl.glPopMatrix();

    if (textureName != null) {
      Texture texture = this.textureCacheService.getTexture(gl, textureName);

      Texture t = this.textureCacheService.getTexture(gl, textureName);
      // this.textures.get(mesh.materialID);// .get(mesh.materialID);
      if (t != null) {
        t.disable(gl);
      }

      gl.glMatrixMode(GL2.GL_TEXTURE);
      gl.glPopMatrix();

      gl.glMatrixMode(GL2.GL_MODELVIEW);
      gl.glPopMatrix();
    }

    gl.glDisable(GL2.GL_TEXTURE_2D);

    gl.glColor4f((float) 255 / 255, (float) 255 / 255, (float) 255 / 255, (float) 255 / 255);

    gl.glDisable(GL2.GL_BLEND);
    gl.glEnable(GL2.GL_DEPTH_TEST);
  }