Example usage for org.lwjgl.opengl GL11 glBegin

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

Introduction

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

Prototype

public static native void glBegin(@NativeType("GLenum") int mode);

Source Link

Document

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

Usage

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

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);//from  w  w  w.j a  va 2s. 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 begin(int primitive) {
    GL11.glBegin(primitive);
}

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

License:Open Source License

@Override
public void onRenderGUI() {
    if (target == null)
        return;//from ww  w  .j  a  v a  2s  . 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();/*from w  w  w . j  a va2s . c  o  m*/

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

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

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

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

                }

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

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

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

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

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

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

                }

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

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

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

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

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

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

                }

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

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

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

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

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

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

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

                // render the internal cube as well                                                  

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

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

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

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

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

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

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

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

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

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

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

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

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

                // render outline of the cube

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

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

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

                }

            }

        }

    }

}

From source file:OpenGLEngine.RenderGrid.java

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

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

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

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

                // render outline

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

                // render grid points

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

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

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

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

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

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

                // render the internal cube as well                

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

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

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

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

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

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

                GL11.glEnd();

                // render outline of the cube

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

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

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

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

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

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline

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

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

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

                }

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

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

                // render outline of the cube

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

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

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

                }

            }

        }

    }

}

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();//w w w  .  ja  v  a2  s. c o  m
            } 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);
            }
        }

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

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

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

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *///from   ww w  .  j ava2  s  . c o  m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 1; i += 2)
        GL11.glVertex2f(values[i], values[i + 1]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *//*from   www .j av  a 2s.c  o  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 2; i += 3)
        GL11.glVertex3f(values[i], values[i + 1], values[i + 2]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *///from   w  ww.j  a v a 2  s .  c  o m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileFourPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 3; i += 4)
        GL11.glVertex4f(values[i], values[i + 1], values[i + 2], values[i + 3]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list with color.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 *//*from   w w  w  .ja v a 2s . com*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float[] vertexValues, float[] colorValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 1; i += 2, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glVertex2f(vertexValues[i], vertexValues[i + 1]);
    }
    GL11.glEnd();
    GL11.glEndList();
}