1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024819: TKOpenGl - extend the ray-tracing core by visualization of lines, text and point sprites

OpenGl_GraphicDriver::Redraw() - do not recompute structures more than required
OpenGl_Workspace::Raytrace() - bind proper FBO before clearing it
Visual3d_View::Redraw() - perform automatic 2nd redraw on device lost
This commit is contained in:
osa
2014-07-03 15:49:48 +04:00
committed by apn
parent 8d3865d870
commit a89742cf17
11 changed files with 508 additions and 93 deletions

View File

@@ -1051,35 +1051,43 @@ void Visual3d_View::Redraw (const Handle(Visual3d_Layer)& theUnderLayer,
return;
}
if (MyGraphicDriver->IsDeviceLost())
{
MyViewManager->RecomputeStructures();
MyViewManager->RecomputeStructures (myImmediateStructures);
MyGraphicDriver->ResetDeviceLostFlag();
}
// set up Z buffer state before redrawing
if (MyViewManager->ZBufferAuto())
{
const Standard_Boolean hasFacet = ContainsFacet();
const Standard_Boolean hasZBuffer = ZBufferIsActivated();
// if the view contains facets and if ZBuffer is not active
if (hasFacet && !hasZBuffer)
{
SetZBufferActivity (1);
}
// if the view contains only facets and if ZBuffer is active
if (!hasFacet && hasZBuffer)
{
SetZBufferActivity (0);
}
}
Aspect_CLayer2d anOverCLayer, anUnderCLayer;
anOverCLayer.ptrLayer = anUnderCLayer.ptrLayer = NULL;
if (!theOverLayer .IsNull()) anOverCLayer = theOverLayer ->CLayer();
if (!theUnderLayer.IsNull()) anUnderCLayer = theUnderLayer->CLayer();
MyGraphicDriver->Redraw (MyCView, anUnderCLayer, anOverCLayer, theX, theY, theWidth, theHeight);
for (Standard_Integer aRetryIter = 0; aRetryIter < 2; ++aRetryIter)
{
if (MyGraphicDriver->IsDeviceLost())
{
MyViewManager->RecomputeStructures();
MyViewManager->RecomputeStructures (myImmediateStructures);
MyGraphicDriver->ResetDeviceLostFlag();
}
// set up Z buffer state before redrawing
if (MyViewManager->ZBufferAuto())
{
const Standard_Boolean hasFacet = ContainsFacet();
const Standard_Boolean hasZBuffer = ZBufferIsActivated();
// if the view contains facets and if ZBuffer is not active
if (hasFacet && !hasZBuffer)
{
SetZBufferActivity (1);
}
// if the view contains only facets and if ZBuffer is active
if (!hasFacet && hasZBuffer)
{
SetZBufferActivity (0);
}
}
MyGraphicDriver->Redraw (MyCView, anUnderCLayer, anOverCLayer, theX, theY, theWidth, theHeight);
if (!MyGraphicDriver->IsDeviceLost())
{
return;
}
}
}
void Visual3d_View::RedrawImmediate()