Hi,
i was wondering if someone else ever ran into this issue:
I am drawing boxes to the viewport using override DrawViewportWires.
it works great, but if i scale the amount of boxes, i consistently hit a limit at about 170 boxes.
when i reach over 170 boxes, i get visual errors.
the lines start to go everywhere (see screenshot)
the blue wires are not supposed to be there.
i have checked if this is a bounding box issue, but that is not the case.
Do i need to update/empty some sort of display cache that is overflowing?
I have tried the same with lines, but i hit the same limit at about 170 boxes
this is a snippet from my code:
any ideas would be appreciated
public override void DrawViewportWires(IGH_PreviewArgs args)
{
if (WorldStorage.World == null) return; //early return.. does not draw anything
var query = new QueryDescription().WithAll<RowLine>();
WorldStorage.World.ParallelQuery(in query, (ref RowLine row) => {
args.Display.DrawLine(new Line(row.Start, row.End), System.Drawing.Color.MediumBlue, 3);
});
var query2 = new QueryDescription().WithAll<Box>();
WorldStorage.World.ParallelQuery(in query2, (ref Box box) =>
{
Point3d[] pts = box.GetCorners();
Line[] lines = new Line[8];
lines[0] = new Line(pts[0], pts[1]);
lines[1] = new Line(pts[1], pts[2]);
lines[2] = new Line(pts[2], pts[3]);
lines[3] = new Line(pts[3], pts[4]);
lines[4] = new Line(pts[4], pts[5]);
lines[5] = new Line(pts[5], pts[6]);
lines[6] = new Line(pts[6], pts[7]);
lines[7] = new Line(pts[7], pts[0]);
foreach (var line in lines) args.Display.DrawLine(line, System.Drawing.Color.Green);
//gives visual errors at over 170 boxes
args.Display.DrawBox(box, System.Drawing.Color.LightSkyBlue, 3); //gives visual errors at over 170 boxes
args.Display.DrawBrepWires(box.ToBrep(), System.Drawing.Color.Red,-1); //this does not work for me... : System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
});
}