예제 #1
0
  private void generateDisplayListWire() {
    float offset = 0.001f;

    displayListWire = glGenLists(1);

    glNewList(displayListWire, GL11.GL_COMPILE);
    glColor4f(0.0f, 0.0f, 0.0f, 1.0f);

    Vector3f dimensions = aabb.getExtents();

    // FRONT
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();

    // BACK
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glEnd();

    // TOP
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glEnd();

    // BOTTOM
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glEnd();

    // LEFT
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();

    // RIGHT
    glBegin(GL_LINE_LOOP);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();
    glEndList();
  }
예제 #2
0
  private void generateDisplayListSolid() {
    displayListSolid = glGenLists(1);

    glNewList(displayListSolid, GL11.GL_COMPILE);
    glBegin(GL_QUADS);
    glColor4f(solidColor.x, solidColor.y, solidColor.z, solidColor.w);

    Vector3f dimensions = aabb.getExtents();

    GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z);
    GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z);

    GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z);
    GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z);
    GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z);
    GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z);

    GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z);
    GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z);

    GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z);
    GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z);

    GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z);
    GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z);
    GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z);

    GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z);
    GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z);
    GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z);
    glEnd();
    glEndList();
  }