- // The glucose engine deals with the core simulation here, we don't need
- // to do anything specific. This method just needs to exist.
+ // Draws the simulation and the 2D UI overlay
+ background(40);
+ color[] colors = glucose.getColors();
+ camera(
+ eyeX, eyeY, eyeZ,
+ midX, midY, midZ,
+ 0, -1, 0
+ );
+ stroke(#333333);
+ fill(#292929);
+ float yFloor = -3;
+ beginShape();
+ vertex(0, yFloor, 0);
+ vertex(glucose.model.xMax, yFloor, 0);
+ vertex(glucose.model.xMax, yFloor, glucose.model.zMax);
+ vertex(0, yFloor, glucose.model.zMax);
+ endShape(CLOSE);
+
+ noFill();
+ strokeWeight(2);
+ beginShape(POINTS);
+ for (Point p : glucose.model.points) {
+ stroke(colors[p.index]);
+ vertex(p.fx, p.fy, p.fz);
+ }
+ endShape();
+
+ // 2D Overlay
+ camera();
+ javax.media.opengl.GL gl= ((PGraphicsOpenGL)g).beginGL();
+ gl.glClear(javax.media.opengl.GL.GL_DEPTH_BUFFER_BIT);
+ ((PGraphicsOpenGL)g).endGL();
+ strokeWeight(1);
+ drawUI();