Lines disappear when zoom or pan

I use Graphic3d_ArrayOfPolylines to draw 10,000s lines at XY plane and it works well.

But when I zoom or pan, some time those lines just disappear.

Here is the code.

void Renderer::AddPolyLines(Handle(Graphic3d_ArrayOfPolylines) array_of_lines)
{
	if (array_of_lines->BoundNumber() > 0) {
		m_PolyLineGroup->SetGroupPrimitivesAspect(m_LineAspect->Aspect());
		m_PolyLineGroup->AddPrimitiveArray(array_of_lines);
		m_prsPresentation->Display();
		m_View->Update();
	}
}

 

Kirill Gavrilov's picture

Probably you didn't update bounding box of displayed structure/presentation.

Max Chen's picture

After manually enlarge the bound box by 2, it works now

Thank you very much.

Kirill Gavrilov's picture

> After manually enlarge the bound box by 2, it works now

That's weird that you need enlarging box...

And why don't you use AIS? Working with presentations like this is not the way it is supposed to be used (these are low-level classes).

Max Chen's picture

I try to build a AIS_Shape from a TopoDS_Compound by adding 10,000s edge to it, it works well, but toke a long time to build. And load 10,000s line into Graphic3d_ArrayOfPolylines and display is really fast.

Kirill Gavrilov's picture

You don't have to use AIS_Shape - you can create a sub-class of AIS_InteractiveObject implementing ::Compute() interface, which will fill presentation with your Graphic3d_ArrayOfPolylines.

Max Chen's picture

Thank you.

Just implement it with AIS_InteractiveObject and it work really well.