Example usage for org.lwjgl.opengl GL11 glVertex3f

List of usage examples for org.lwjgl.opengl GL11 glVertex3f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glVertex3f.

Prototype

public static native void glVertex3f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Specifies a single vertex between #glBegin Begin and #glEnd End by giving its coordinates in three dimensions.

Usage

From source file:net.mechanicalcat.pycode.obj.Model.java

License:Open Source License

public void genList() {
    this.glList = GL11.glGenLists(1);
    GL11.glNewList(this.glList, GL11.GL_COMPILE);
    //        if use_texture: glEnable(GL_TEXTURE_2D)
    GL11.glFrontFace(GL11.GL_CCW);/*  w ww  .j a  v  a 2s.c o  m*/
    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glCullFace(GL11.GL_BACK);
    String currentMaterial = "";
    Material mtl;
    for (Face face : this.faces) {
        if (!face.material.equals(currentMaterial)) {
            currentMaterial = face.material;
            mtl = this.materials.get(face.material);
            if (mtl == null) {
                GL11.glColor3f(1, 1, 1);
            } else {
                //                    if 'texture_Kd' in mtl:
                //                    # use diffuse texmap
                //                    glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd'])
                GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z);
            }
        }

        GL11.glBegin(GL11.GL_POLYGON);
        for (int i = 0; i < face.vertexes.size(); i++) {
            if (face.normals.get(i) != 0) {
                Vector3f n = this.normals.get(face.normals.get(i));
                GL11.glNormal3f(n.x, n.y, n.z);
            }
            //                if texture_coords[i]:
            //                    glTexCoord2fv(self.texcoords[texture_coords[i] - 1])
            Vector3f v = this.vertices.get(face.vertexes.get(i));
            GL11.glVertex3f(v.x, v.y, v.z);
        }
        GL11.glEnd();
    }

    GL11.glCullFace(GL11.GL_BACK);
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

    GL11.glDisable(GL11.GL_CULL_FACE);

    //      if use_texture: glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEndList();
}

From source file:net.phatcode.rel.multimedia.Graphics.java

License:Open Source License

public void drawSpriteOnLine(int x1, int y1, int x2, int y2, int width, int type) {

    SpriteGL sprite = glowImages.getSprite(type % glowImages.getNumImages());

    // Only change active texture when there is a need
    // Speeds up the rendering by batching textures

    if (sprite.textureID != currentTexture) {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, sprite.textureID);
        currentTexture = sprite.textureID;
    }//  www .j ava2 s  .  co  m

    float u1 = sprite.u1;
    float v1 = sprite.v1;
    float u2 = sprite.u2;
    float v2 = sprite.v2;
    float uh = (u1 + u2) / 2.0f;

    float nx, ny;
    nx = -(y2 - y1);
    ny = (x2 - x1);

    float leng;
    leng = (float) Math.sqrt(nx * nx + ny * ny);
    nx = nx / leng;
    ny = ny / leng;

    nx *= width / 2.0;
    ny *= width / 2.0;

    float lx1, ly1, lx2, ly2, lx3, ly3, lx4, ly4;

    lx1 = x2 + nx;
    ly1 = y2 + ny;
    lx2 = x2 - nx;
    ly2 = y2 - ny;
    lx3 = x1 - nx;
    ly3 = y1 - ny;
    lx4 = x1 + nx;
    ly4 = y1 + ny;

    // MAIN
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx1, ly1, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx2, ly2, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx3, ly3, 0.0f);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx4, ly4, 0.0f);
    GL11.glEnd();

    //RIGHT
    float lx5, ly5, lx6, ly6, vx, vy;
    vx = (x2 - x1);
    vy = (y2 - y1);
    leng = (float) Math.sqrt(vx * vx + vy * vy);
    vx = vx / leng;
    vy = vy / leng;
    vx *= width / 2.0;
    vy *= width / 2.0;

    lx5 = lx1 + vx;
    ly5 = ly1 + vy;
    lx6 = lx2 + vx;
    ly6 = ly2 + vy;

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx1, ly1, 0.0f);
    GL11.glTexCoord2f(u2, v1);
    GL11.glVertex3f(lx5, ly5, 0.0f);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(lx6, ly6, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx2, ly2, 0.0f);
    GL11.glEnd();

    // LEFT
    lx5 = lx4 - vx;
    ly5 = ly4 - vy;
    lx6 = lx3 - vx;
    ly6 = ly3 - vy;

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx4, ly4, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx3, ly3, 0.0f);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(lx6, ly6, 0.0f);
    GL11.glTexCoord2f(u2, v1);
    GL11.glVertex3f(lx5, ly5, 0.0f);
    GL11.glEnd();

}

From source file:net.phatcode.rel.multimedia.Graphics.java

License:Open Source License

public void drawSpriteOnLine(int x1, int y1, int x2, int y2, int width, int type, float r, float g, float b,
        float a) {

    SpriteGL sprite = glowImages.getSprite(type % glowImages.getNumImages());

    // Only change active texture when there is a need
    // Speeds up the rendering by batching textures

    if (sprite.textureID != currentTexture) {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, sprite.textureID);
        currentTexture = sprite.textureID;
    }/*from ww  w . j  av  a 2s  .co  m*/

    GL11.glColor4f(r, g, b, a);

    float u1 = sprite.u1;
    float v1 = sprite.v1;
    float u2 = sprite.u2;
    float v2 = sprite.v2;
    float uh = (u1 + u2) / 2.0f;

    float nx, ny;
    nx = -(y2 - y1);
    ny = (x2 - x1);

    float leng;
    leng = (float) Math.sqrt(nx * nx + ny * ny);
    nx = nx / leng;
    ny = ny / leng;

    nx *= width / 2.0;
    ny *= width / 2.0;

    float lx1, ly1, lx2, ly2, lx3, ly3, lx4, ly4;

    lx1 = x2 + nx;
    ly1 = y2 + ny;
    lx2 = x2 - nx;
    ly2 = y2 - ny;
    lx3 = x1 - nx;
    ly3 = y1 - ny;
    lx4 = x1 + nx;
    ly4 = y1 + ny;

    // MAIN
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx1, ly1, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx2, ly2, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx3, ly3, 0.0f);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx4, ly4, 0.0f);
    GL11.glEnd();

    //RIGHT
    float lx5, ly5, lx6, ly6, vx, vy;
    vx = (x2 - x1);
    vy = (y2 - y1);
    leng = (float) Math.sqrt(vx * vx + vy * vy);
    vx = vx / leng;
    vy = vy / leng;
    vx *= width / 2.0;
    vy *= width / 2.0;

    lx5 = lx1 + vx;
    ly5 = ly1 + vy;
    lx6 = lx2 + vx;
    ly6 = ly2 + vy;

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx1, ly1, 0.0f);
    GL11.glTexCoord2f(u2, v1);
    GL11.glVertex3f(lx5, ly5, 0.0f);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(lx6, ly6, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx2, ly2, 0.0f);
    GL11.glEnd();

    // LEFT
    lx5 = lx4 - vx;
    ly5 = ly4 - vy;
    lx6 = lx3 - vx;
    ly6 = ly3 - vy;

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(uh, v1);
    GL11.glVertex3f(lx4, ly4, 0.0f);
    GL11.glTexCoord2f(uh, v2);
    GL11.glVertex3f(lx3, ly3, 0.0f);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(lx6, ly6, 0.0f);
    GL11.glTexCoord2f(u2, v1);
    GL11.glVertex3f(lx5, ly5, 0.0f);
    GL11.glEnd();

}

From source file:net.shadowmage.ancientwarfare.core.model.ModelPiece.java

License:Open Source License

public void renderForEditor(ModelPiece piece, Primitive prim, List<ModelPiece> highlightedPieces, float tw,
        float th) {
    GL11.glPushMatrix();/*from   ww w  .ja  v  a  2 s  . c om*/
    if (x != 0 || y != 0 || z != 0) {
        GL11.glTranslatef(x, y, z);
    }
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    boolean selected = piece == this;
    boolean colored = selected || highlightedPieces.contains(this);
    if (selected) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        GL11.glColor4f(1.0f, 0.f, 0.f, 1.f);
        GL11.glPointSize(5.f);
        GL11.glBegin(GL11.GL_POINTS);
        GL11.glVertex3f(0, 0, 0);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    if (colored) {
        GL11.glColor4f(0.75f, 0.5f, 0.5f, 1.f);
    } else {
        GL11.glColor4f(1.f, 1.f, 1.f, 1.f);
    }
    for (Primitive primitive : this.primitives) {
        if (primitive == prim) {
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glColor4f(1.0f, 0.f, 0.f, 1.f);
            GL11.glBegin(GL11.GL_POINTS);
            GL11.glVertex3f(prim.x, prim.y, prim.z);
            GL11.glEnd();
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glColor4f(1.0f, 0.5f, 0.5f, 1.f);
        } else if (colored) {
            GL11.glColor4f(0.75f, 0.5f, 0.5f, 1.f);
        } else {
            GL11.glColor4f(1.f, 1.f, 1.f, 1.f);
        }
        primitive.render(tw, th);
    }
    for (ModelPiece child : this.children) {
        child.renderForEditor(piece, prim, highlightedPieces, tw, th);
    }
    GL11.glPopMatrix();
}

From source file:net.shadowmage.ancientwarfare.core.model.PrimitiveBox.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    float px = 1.f / tw;
    float py = 1.f / th;
    float w = (float) Math.ceil((x2 - x1) * 16.f);
    float h = (float) Math.ceil((y2 - y1) * 16.f);
    float l = (float) Math.ceil((z2 - z1) * 16.f);
    float ty = this.ty();
    float tx = this.tx();

    float tx1, ty1, tx2, ty2;
    if (w < 1) {
        w = 1;//from w w  w .j  a  va 2s.c  om
    }
    if (h < 1) {
        h = 1;
    }
    if (l < 1) {
        l = 1;
    }

    //render the cube. only called a single time when building the display list for a piece
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);

    //front side  
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 0, 1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, z2);

    ////rear side
    tx1 = (tx + l + l + w) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w + l + w) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 0, -1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z1);

    //right side
    tx1 = (tx + l + w) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w + l) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(-1, 0, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, z1);

    //  //left side
    tx1 = (tx) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(1, 0, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z2);

    //  //top side
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 1, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y2, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y2, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z2);

    //  //bottom side
    tx1 = (tx + l + w) * px;
    ty1 = (th - (ty + l)) * py;
    tx2 = (tx + l + w + w) * px;
    ty2 = (th - (ty)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y1, z1);

    GL11.glEnd();
}

From source file:net.shadowmage.ancientwarfare.core.model.PrimitiveQuad.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    float px = 1.f / tw;
    float py = 1.f / th;
    float w = (x2 - x1) * 16.f;
    float l = 1.f;//TODO fix this for proper texture handling
    float h = (y2 - y1) * 16.f;
    float ty = this.ty();
    float tx = this.tx();

    float tx1, ty1, tx2, ty2;

    //render the cube. only called a single time when building the display list for a piece
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);/*  w  w w . j a  va2  s.co m*/
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);

    //front side  
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty + l)) * py;

    GL11.glNormal3f(0, 0, 1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, 0.f);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, 0.f);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, 0.f);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, 0.f);

    GL11.glEnd();
}

From source file:net.shadowmage.ancientwarfare.core.model.PrimitiveTriangle.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);/*from  w w w  .  j  av a2  s.c o m*/
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    float px = 1.f / tw;
    float py = 1.f / th;

    float u1, v1, u2, v2, u3, v3;
    u1 = this.u1 * px + this.tx() * px;
    u2 = this.u2 * px + this.tx() * px;
    u3 = this.u3 * px + this.tx() * px;
    v1 = this.v1 * py + this.ty() * py;
    v2 = this.v2 * py + this.ty() * py;
    v3 = this.v3 * py + this.ty() * py;
    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
    GL11.glNormal3f(normalX, normalY, normalZ);
    GL11.glTexCoord2f(u1, v1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glTexCoord2f(u3, v3);
    GL11.glVertex3f(x3, y3, z3);
    GL11.glEnd();
}

From source file:net.smert.frameworkgl.opengl.helpers.LegacyRenderHelper.java

License:Apache License

public void vertex(float x, float y, float z) {
    GL11.glVertex3f(x, y, z);
}

From source file:OpenGLEngine.RenderGrid.java

public static void RenderGridProposedGhostAtoms(NICS_Grid GridToRender, Object GhastlyLock) {
    float X, Y, Z;
    synchronized (GhastlyLock) {
        // should only render a grid
        assert (GridToRender.GhostSetType() == 3);

        //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 
        // for only a z-plane: 8,7,3,4
        // for only a y plane: 1,5,8,4
        // for only an x-plane: 1,2,3,4 

        // render highlighted planes / cubes
        if (GridToRender.IsHighlighted()) {
            if (GridToRender.X_Plane) {
                // Render Highlight of Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();/*from w w w .j av  a 2s .  c  o m*/

                // render outline
                GL11.glLineWidth(RenderSettings.OutlineLineWidth);

                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

                //ArrayList<Vector3f[]> QuadPoints   
            } else if (GridToRender.Y_Plane) {
                // Render Highlight of Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline
                GL11.glLineWidth(RenderSettings.OutlineLineWidth);

                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Z_Plane) {
                // Render Highlight of Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline
                GL11.glLineWidth(RenderSettings.OutlineLineWidth);

                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else {
                // Render Highlight of Bounding Box
                //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);
                GL11.glEnd();

                // render the internal cube as well                                                  

                GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y,
                        RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);

                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);

                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline of the cube
                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);

                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            }
            // render 'non-highlighted' planes/cubes 
        } else {
            if (GridToRender.X_Plane) {
                // Render Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y,
                        RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x,
                        RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z,
                        RenderSettings.GridOutlineProposedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Y_Plane) {
                // Render Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y,
                        RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x,
                        RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z,
                        RenderSettings.GridOutlineProposedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Z_Plane) {
                // Render Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y,
                        RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x,
                        RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z,
                        RenderSettings.GridOutlineProposedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else {
                // Render Bounding Box 
                //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 

                GL11.glColor4f(RenderSettings.GridCubeProposedColor.x, RenderSettings.GridCubeProposedColor.y,
                        RenderSettings.GridCubeProposedColor.z, RenderSettings.GridCubeProposedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);

                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);

                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline of the cube

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineProposedColor.x,
                        RenderSettings.GridOutlineProposedColor.y, RenderSettings.GridOutlineProposedColor.z,
                        RenderSettings.GridOutlineProposedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render the grid points
                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointProposedColor.x,
                            RenderSettings.GridSurfacePointProposedColor.y,
                            RenderSettings.GridSurfacePointProposedColor.z,
                            RenderSettings.GridOutlineProposedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            }

        }

    }

}

From source file:OpenGLEngine.RenderGrid.java

public static void RenderGridGhostAtoms(NICS_Grid GridToRender, Object GhastlyLock) {
    float X, Y, Z;
    synchronized (GhastlyLock) {
        // should only render a grid
        assert (GridToRender.GhostSetType() == 3);

        //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 
        // for only a z-plane: 8,7,3,4
        // for only a y plane: 1,5,8,4
        // for only an x-plane: 1,2,3,4 

        // render highlighted planes / cubes
        if (GridToRender.IsHighlighted()) {
            if (GridToRender.X_Plane) {
                // Render Highlight of Bounding plane               

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();/*from  ww w. ja v  a 2 s  .c  o  m*/

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                // render grid points

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Y_Plane) {
                // Render Highlight of Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Z_Plane) {
                // Render Highlight of Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else {
                // Render Highlight of Bounding Box
                //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[1].x, GridToRender.CubeSelectedPoints[1].y,
                        GridToRender.CubeSelectedPoints[1].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[2].x, GridToRender.CubeSelectedPoints[2].y,
                        GridToRender.CubeSelectedPoints[2].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[6].x, GridToRender.CubeSelectedPoints[6].y,
                        GridToRender.CubeSelectedPoints[6].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[5].x, GridToRender.CubeSelectedPoints[5].y,
                        GridToRender.CubeSelectedPoints[5].z);

                GL11.glVertex3f(GridToRender.CubeSelectedPoints[8].x, GridToRender.CubeSelectedPoints[8].y,
                        GridToRender.CubeSelectedPoints[8].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[7].x, GridToRender.CubeSelectedPoints[7].y,
                        GridToRender.CubeSelectedPoints[7].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[3].x, GridToRender.CubeSelectedPoints[3].y,
                        GridToRender.CubeSelectedPoints[3].z);
                GL11.glVertex3f(GridToRender.CubeSelectedPoints[4].x, GridToRender.CubeSelectedPoints[4].y,
                        GridToRender.CubeSelectedPoints[4].z);
                GL11.glEnd();

                // render the internal cube as well                

                GL11.glColor4f(RenderSettings.GridCubeSelectedColor.x, RenderSettings.GridCubeSelectedColor.y,
                        RenderSettings.GridCubeSelectedColor.z, RenderSettings.GridCubeSelectedColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y,
                        RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);

                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);

                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);

                GL11.glEnd();

                // render outline of the cube

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineSelectedColor.x,
                        RenderSettings.GridOutlineSelectedColor.y, RenderSettings.GridOutlineSelectedColor.z,
                        RenderSettings.GridOutlineSelectedColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);

                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);

                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);

                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);

                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);

                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointSelectedColor.x,
                            RenderSettings.GridSurfacePointSelectedColor.y,
                            RenderSettings.GridSurfacePointSelectedColor.z,
                            RenderSettings.GridOutlineSelectedColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            }
            // render 'non-highlighted' planes/cubes 
        } else {
            if (GridToRender.X_Plane) {
                // Render Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y,
                        RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y,
                        RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Y_Plane) {
                // Render Bounding plane

                GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y,
                        RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y,
                        RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else if (GridToRender.Z_Plane) {
                // Render Bounding plane                

                GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y,
                        RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y,
                        RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            } else {
                // Render Bounding Box 
                //faces points for a full cube: 1,2,3,4; 6,2,3,7; 5,6,7,8; 1,5,8,4; 1,2,6,5; 8,7,3,4; 

                GL11.glColor4f(RenderSettings.GridCubeColor.x, RenderSettings.GridCubeColor.y,
                        RenderSettings.GridCubeColor.z, RenderSettings.GridCubeColor.w);
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                // render outline of the cube

                GL11.glLineWidth(RenderSettings.OutlineLineWidth);
                GL11.glColor4f(RenderSettings.GridOutlineColor.x, RenderSettings.GridOutlineColor.y,
                        RenderSettings.GridOutlineColor.z, RenderSettings.GridOutlineColor.w);
                GL11.glBegin(GL11.GL_LINES);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[2].x, GridToRender.CubePoints[2].y,
                        GridToRender.CubePoints[2].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[3].x, GridToRender.CubePoints[3].y,
                        GridToRender.CubePoints[3].z);
                GL11.glVertex3f(GridToRender.CubePoints[6].x, GridToRender.CubePoints[6].y,
                        GridToRender.CubePoints[6].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[7].x, GridToRender.CubePoints[7].y,
                        GridToRender.CubePoints[7].z);
                GL11.glVertex3f(GridToRender.CubePoints[5].x, GridToRender.CubePoints[5].y,
                        GridToRender.CubePoints[5].z);
                GL11.glVertex3f(GridToRender.CubePoints[1].x, GridToRender.CubePoints[1].y,
                        GridToRender.CubePoints[1].z);
                GL11.glVertex3f(GridToRender.CubePoints[8].x, GridToRender.CubePoints[8].y,
                        GridToRender.CubePoints[8].z);
                GL11.glVertex3f(GridToRender.CubePoints[4].x, GridToRender.CubePoints[4].y,
                        GridToRender.CubePoints[4].z);
                GL11.glEnd();

                if (!RenderSettings.RenderPointsAsQuad) {
                    GL11.glPointSize(RenderSettings.GridPointSize);
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_POINTS);
                    for (int itor = 0; itor < GridToRender.SurfaceAtomCoordinates.size(); itor++) {

                        GL11.glVertex3f(GridToRender.SurfaceAtomCoordinates.get(itor).x,
                                GridToRender.SurfaceAtomCoordinates.get(itor).y,
                                GridToRender.SurfaceAtomCoordinates.get(itor).z);
                    }
                    GL11.glEnd();
                    // render the points as a quad
                } else if (GridToRender.QuadPoints.size() < RenderSettings.NO_DISPLAY) {
                    GL11.glColor4f(RenderSettings.GridSurfacePointColor.x,
                            RenderSettings.GridSurfacePointColor.y, RenderSettings.GridSurfacePointColor.z,
                            RenderSettings.GridOutlineColor.w);
                    GL11.glBegin(GL11.GL_TRIANGLES);
                    for (int itor = 0; itor < GridToRender.QuadPoints.size(); itor++) {
                        // rendered as a triangle instead
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[1].x;
                        Y = GridToRender.QuadPoints.get(itor)[1].y;
                        Z = GridToRender.QuadPoints.get(itor)[1].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[0].x;
                        Y = GridToRender.QuadPoints.get(itor)[0].y;
                        Z = GridToRender.QuadPoints.get(itor)[0].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[2].x;
                        Y = GridToRender.QuadPoints.get(itor)[2].y;
                        Z = GridToRender.QuadPoints.get(itor)[2].z;
                        GL11.glVertex3f(X, Y, Z);
                        X = GridToRender.QuadPoints.get(itor)[3].x;
                        Y = GridToRender.QuadPoints.get(itor)[3].y;
                        Z = GridToRender.QuadPoints.get(itor)[3].z;
                        GL11.glVertex3f(X, Y, Z);
                    }
                    GL11.glEnd();

                }

            }

        }

    }

}