@Override
	public void display(GLAutoDrawable glDrawable) {
		
		GL2 gl = glDrawable.getGL().getGL2();	
		
		gl.glClearColor(1, 1, 1, 0);
		gl.glClearDepth(1);
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glLoadIdentity();
		

		gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, mat_front,0);
		gl.glMaterialfv(GL2.GL_BACK, GL2.GL_AMBIENT_AND_DIFFUSE, mat_back,0);
		gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_SPECULAR, mat_specular,0);
		gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_SHININESS, mat_shininess,0);
		gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, light0_ambient,0);
		gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, light0_diffuse,0);
		gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, light0_specular,0);
		gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, global_ambient,0);
		gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL2.GL_FALSE);
		gl.glLightModeli(GL2.GL_LIGHT_MODEL_TWO_SIDE, GL2.GL_TRUE);
		gl.glEnable(GL2.GL_LIGHTING);
		gl.glEnable(GL2.GL_LIGHT0);
	    
	    gl.glDepthFunc(GL2.GL_LESS);
	    gl.glEnable(GL2.GL_DEPTH_TEST);
	    gl.glDisable(GL2.GL_CULL_FACE);
	    gl.glShadeModel(GL2.GL_FLAT);
	    gl.glEnable(GL2.GL_NORMALIZE);
	    
	    gl.glPushMatrix();
	    gl.glTranslatef(X_pos, Y_pos, Z_pos);

		gl.glPushMatrix();
		gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
		gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
		gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
		// gl.glPopMatrix();
	   
		//gl.glPopMatrix();
		
		//draw test vertex
		/*
		gl.glDisable(GL2.GL_LIGHTING);
	    gl.glPointSize(8.0f);
	    gl.glBegin(GL2.GL_POINTS);
	    gl.glColor3f(0.0f, 0.0f, 0.0f);
		gl.glVertex3fv(heVertList.get(testVert).coordinate.toArray(), 0);
	    gl.glEnd();
	    gl.glEnable(GL2.GL_LIGHTING);
	    */
	    
	    // Draw mesh - first pass
	    if (drawEdges) {
	      gl.glPolygonOffset(1, 1);
	      gl.glEnable(GL2.GL_POLYGON_OFFSET_FILL);
	    }
	    gl.glBegin(GL2.GL_TRIANGLES);
	    //int nf = FACES.length;
	    int nf = heFaceList.size();
		for (int i = 0; i < nf; i++) {

			if (heFaceList.get(i).edge == null)
				continue;
			
			Vector3D v0 = heFaceList.get(i).edge.v_begin.coordinate.copy();
			Vector3D v1 = heFaceList.get(i).edge.he_next.v_begin.coordinate.copy();
			Vector3D v2 = heFaceList.get(i).edge.he_next.he_next.v_begin.coordinate.copy();
			
			//Vector3D v0 = VERTICES[FACES[i][0]].copy();
			//Vector3D v1 = VERTICES[FACES[i][1]].copy();
			//Vector3D v2 = VERTICES[FACES[i][2]].copy();
			v1.subtract(v0);
			v2.subtract(v0);
			Vector3D norm = v1.crossProduct(v2);

			gl.glNormal3fv(norm.toArray(), 0);
			gl.glVertex3fv(VERTICES[FACES[i][0]].toArray(), 0);
			gl.glVertex3fv(VERTICES[FACES[i][1]].toArray(), 0);
			gl.glVertex3fv(VERTICES[FACES[i][2]].toArray(), 0);
		}
	    gl.glEnd();

	    // Draw mesh - second pass to draw the edges on top
	    if (drawEdges) {
	      gl.glDisable(GL2.GL_POLYGON_OFFSET_FILL);
	      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
	      gl.glLineWidth(1.0f);
	      float[] mat_diffuse= { 0.0f, 0.0f, 1.0f, 1.0f };
	      gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE, mat_diffuse, 0);
	      gl.glBegin(GL2.GL_TRIANGLES);
			for (int i = 0; i < nf; i++) {
				if (heFaceList.get(i).edge == null)
					continue;

				Vector3D v0 = heFaceList.get(i).edge.v_begin.coordinate.copy();
				Vector3D v1 = heFaceList.get(i).edge.he_next.v_begin.coordinate.copy();
				Vector3D v2 = heFaceList.get(i).edge.he_next.he_next.v_begin.coordinate.copy();

				// Vector3D v0 = VERTICES[FACES[i][0]].copy();
				// Vector3D v1 = VERTICES[FACES[i][1]].copy();
				// Vector3D v2 = VERTICES[FACES[i][2]].copy();
				v1.subtract(v0);
				v2.subtract(v0);
				Vector3D norm = v1.crossProduct(v2);

				gl.glNormal3fv(norm.toArray(), 0);
				gl.glVertex3fv(VERTICES[FACES[i][0]].toArray(), 0);
				gl.glVertex3fv(VERTICES[FACES[i][1]].toArray(), 0);
				gl.glVertex3fv(VERTICES[FACES[i][2]].toArray(), 0);
			}
	      gl.glEnd();
	      gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);
	    }
	    
	    

	    gl.glPopMatrix();
	    gl.glDisable(GL2.GL_DEPTH_TEST);
	    gl.glDisable(GL2.GL_LIGHTING);
	    

		if (showFPS) {
			computeFPS();
			textrenderer.beginRendering(glDrawable.getWidth(),
					glDrawable.getHeight());
			gl.glColor3f(0.1f, 0.1f, 0.1f);
			String temp = " Vertices: "+heVertList.size()+" Edges: "+(heEdgeList.size())/2 + " Faces: "+heFaceList.size();
			textrenderer.draw("FPS: " + fpsStr + temp, 10, 10);
			textrenderer.draw("Hold mouse left to drag, middle to move, right to zoom.", 10, HEIGHT-20);
			textrenderer.draw("Press E to show mesh edges, D to decimate meshes.", 10, HEIGHT-40);
			textrenderer.endRendering();
		}

	}