From dfae4e3d9a171d2bba62d828ef4b5ce3980f90a7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 14 Apr 2023 17:51:50 +0200 Subject: GraphUI Group.drawImpl0(): Copy List to array and sort using Shape.ZAscendingComparator - fixes z-order issue, as we shall do same approach as in Scene.display() - fixes mutated container issue if a Shape gets removed or added to original List --- src/graphui/classes/com/jogamp/graph/ui/Group.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph') diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java index e748969cf..d89d91c8c 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Group.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java @@ -28,6 +28,7 @@ package com.jogamp.graph.ui; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.List; @@ -191,12 +192,16 @@ public class Group extends Shape implements Container { @Override public final boolean isFrustumCullingEnabled() { return doFrustumCulling; } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override protected final void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount, final float[] rgba) { final PMVMatrix pmv = renderer.getMatrix(); - final int shapeCount = shapes.size(); + final Object[] shapesS = shapes.toArray(); + Arrays.sort(shapesS, (Comparator)Shape.ZAscendingComparator); + + final int shapeCount = shapesS.length; for(int i=0; i