From 21ec35ed215e020bc869903b3834627cfd33d8ee Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 9 May 2006 12:22:33 +0000 Subject: [PATCH] fixes to handle flush() at end of frame --- core/PGraphics3.java | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/core/PGraphics3.java b/core/PGraphics3.java index 0fa2a7db9..7cf8aa87b 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -311,8 +311,8 @@ public class PGraphics3 extends PGraphics { // clear out the lights, they'll have to be turned on again lightCount = 0; lightingDependsOnVertexPosition = false; - lightFalloff(1, 0, 0); - lightSpecular(0, 0, 0); + lightFalloff(1, 0, 0); + lightSpecular(0, 0, 0); // reset lines lineCount = 0; @@ -344,20 +344,32 @@ public class PGraphics3 extends PGraphics { // shapes were already rendered in endShape(); // (but can't return, since needs to update memimgsrc if (hints[ENABLE_DEPTH_SORT]) { - if (triangleCount > 0) { - depth_sort_triangles(); - render_triangles(); - } - if (lineCount > 0) { - depth_sort_lines(); - render_lines(); - } + flush(); } // blit to screen super.endFrame(); } + /** + * Emit any sorted geometry that's been collected on this frame. + */ + protected void flush() { + if (triangleCount > 0) { + if (hints[ENABLE_DEPTH_SORT]) { + depth_sort_triangles(); + } + render_triangles(); + } + if (lineCount > 0) { + if (hints[ENABLE_DEPTH_SORT]) { + depth_sort_lines(); + } + render_lines(); + } + } + + public void defaults() { super.defaults();