Example usage for org.lwjgl.opengl GL11 glEnd

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

Introduction

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

Prototype

public static native void glEnd();

Source Link

Document

Ends the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

From source file:net.quetzi.bluepower.part.gate.GateBase.java

License:Open Source License

@Override
public final void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();//w  w  w . j av  a 2s  .  com
    {

        if (type == ItemRenderType.INVENTORY) {
            GL11.glTranslated(0, 0.5, 0);
            GL11.glRotated(-12, -1, 0, 1);
        }

        /* Top */
        renderTop();

        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/bottom.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* Bottom */
        GL11.glNormal3d(0, -1, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        GL11.glEnd();
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/side.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* East */
        GL11.glNormal3d(1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        /* West */
        GL11.glNormal3d(-1, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        /* North */
        GL11.glNormal3d(0, 0, -1);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 1);
        /* South */
        GL11.glNormal3d(0, 0, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 0);
        GL11.glEnd();
    }
    GL11.glPopMatrix();
}

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 w w  w. j a va2 s  .c o  m*/
    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 ww .j ava 2s . co m*/
    }
    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);/*from   www.jav a2 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  ww w .ja  v  a2s.  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 end() {
    GL11.glEnd();
}

From source file:net.wurstclient.features.mods.BowAimbotMod.java

License:Open Source License

@Override
public void onRenderGUI() {
    if (target == null)
        return;//from w ww . j a  va2s.c o m

    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glPushMatrix();

    String message;
    if (velocity < 1)
        message = "Charging: " + (int) (velocity * 100) + "%";
    else
        message = "Ready To Shoot";

    // translate to center
    ScaledResolution sr = new ScaledResolution(mc);
    int msgWidth = Fonts.segoe15.getStringWidth(message);
    GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2, sr.getScaledHeight() / 2 + 1, 0);

    // background
    GL11.glColor4f(0, 0, 0, 0.5F);
    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glVertex2d(0, 0);
        GL11.glVertex2d(msgWidth + 3, 0);
        GL11.glVertex2d(msgWidth + 3, 10);
        GL11.glVertex2d(0, 10);
    }
    GL11.glEnd();

    // text
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    Fonts.segoe15.drawString(message, 2, -1, 0xffffffff);

    GL11.glPopMatrix();

    // GL resets
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
}

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();

                // 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();/*from   w w w . ja v a  2  s .  com*/

                // 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();

                // 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();/*from  www . j  a v a 2 s  .co  m*/

                // 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();

                }

            }

        }

    }

}

From source file:org.agpu.oc.common.tileentity.AdvancedMonitor.java

public void swapBuffers(NBTTagCompound tag) {
    if (worldObj.isRemote) {
        for (int i = 0; i < tag.getInteger("commands"); i++) {
            NBTTagCompound t = tag.getCompoundTag(String.valueOf(i));
            String type = t.getString("type");
            if (type.equals("startDrawing3D")) {
                startDrawing3D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"),
                        t.getInteger("height"), t.getFloat("fov"), t.getFloat("zNear"), t.getFloat("zFar"));
            } else if (type.equals("startDrawing2D")) {
                startDrawing2D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"),
                        t.getInteger("height"));
            } else if (type.equals("setColor")) {
                GL11.glColor4f(t.getFloat("r"), t.getFloat("g"), t.getFloat("b"), t.getFloat("a"));
            } else if (type.equals("vertex3f")) {
                GL11.glVertex3f(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("vertex2i")) {
                GL11.glVertex2i(t.getInteger("x"), t.getInteger("y"));
            } else if (type.equals("translate")) {
                GL11.glTranslatef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("rotate")) {
                GL11.glRotatef(t.getFloat("angle"), t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("scale")) {
                GL11.glScalef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("begin")) {
                GL11.glBegin(t.getInteger("m"));
            } else if (type.equals("end")) {
                GL11.glEnd();
            } else if (type.equals("string")) {
                Minecraft.getMinecraft().fontRendererObj.drawString(t.getString("string"), t.getInteger("x"),
                        t.getInteger("y"), t.getInteger("color"));
            } else if (type.equals("enable")) {
                GL11.glEnable(t.getInteger("v"));
            } else if (type.equals("disable")) {
                GL11.glDisable(t.getInteger("v"));
            } else {
                System.out.println("Unknown packet type received: " + type);
            }//  ww w  .jav a  2  s  .c  o m
        }

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPopMatrix();
        GL11.glPopAttrib();
    }
}