mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0026538: Visualization - Infinite growth of maxtrix stack in OpenGl_Structure::Render
Test case for issue CR26538 Small correction
This commit is contained in:
parent
5ad8c033aa
commit
d437b80dd7
@ -538,22 +538,21 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
|
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
|
||||||
|
|
||||||
// Apply local transformation
|
// Apply local transformation
|
||||||
OpenGl_Mat4 aModelWorld;
|
|
||||||
if (myTransformation)
|
if (myTransformation)
|
||||||
{
|
{
|
||||||
OpenGl_Transposemat3 ((OpenGl_Matrix*)aModelWorld.ChangeData(), myTransformation);
|
OpenGl_Matrix aModelWorld;
|
||||||
|
OpenGl_Transposemat3 (&aModelWorld, myTransformation);
|
||||||
|
aCtx->ModelWorldState.Push();
|
||||||
|
aCtx->ModelWorldState.SetCurrent (OpenGl_Mat4::Map ((Standard_ShortReal* )aModelWorld.mat));
|
||||||
|
|
||||||
Standard_ShortReal aScaleX = OpenGl_Vec3 (aModelWorld.GetValue (0, 0),
|
Standard_ShortReal aScaleX = OpenGl_Vec3 (myTransformation->mat[0][0],
|
||||||
aModelWorld.GetValue (1, 0),
|
myTransformation->mat[0][1],
|
||||||
aModelWorld.GetValue (2, 0)).SquareModulus();
|
myTransformation->mat[0][2]).SquareModulus();
|
||||||
// Scale transform detected.
|
// Scale transform detected.
|
||||||
if (Abs (aScaleX - 1.f) > Precision::Confusion())
|
if (Abs (aScaleX - 1.f) > Precision::Confusion())
|
||||||
{
|
{
|
||||||
aCtx->SetGlNormalizeEnabled (Standard_True);
|
aCtx->SetGlNormalizeEnabled (Standard_True);
|
||||||
}
|
}
|
||||||
|
|
||||||
aCtx->ModelWorldState.Push();
|
|
||||||
aCtx->ModelWorldState.SetCurrent (aModelWorld);
|
|
||||||
}
|
}
|
||||||
if (TransformPersistence.Flags)
|
if (TransformPersistence.Flags)
|
||||||
{
|
{
|
||||||
@ -567,11 +566,9 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
aCtx->WorldViewState.SetCurrent (aWorldView);
|
aCtx->WorldViewState.SetCurrent (aWorldView);
|
||||||
aCtx->ApplyProjectionMatrix();
|
aCtx->ApplyProjectionMatrix();
|
||||||
}
|
}
|
||||||
if (aModelWorld || TransformPersistence.Flags)
|
|
||||||
{
|
|
||||||
aCtx->ApplyModelViewMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Take into account transform persistence
|
||||||
|
aCtx->ApplyModelViewMatrix();
|
||||||
|
|
||||||
// Apply aspects
|
// Apply aspects
|
||||||
const OpenGl_AspectLine *anAspectLine = theWorkspace->AspectLine (Standard_False);
|
const OpenGl_AspectLine *anAspectLine = theWorkspace->AspectLine (Standard_False);
|
||||||
@ -681,7 +678,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore local transformation
|
// Restore local transformation
|
||||||
if (!aModelWorld.IsIdentity())
|
if (myTransformation)
|
||||||
{
|
{
|
||||||
aCtx->ModelWorldState.Pop();
|
aCtx->ModelWorldState.Pop();
|
||||||
aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
|
aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
|
||||||
@ -692,10 +689,6 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
|||||||
aCtx->WorldViewState.Pop();
|
aCtx->WorldViewState.Pop();
|
||||||
aCtx->ApplyProjectionMatrix();
|
aCtx->ApplyProjectionMatrix();
|
||||||
}
|
}
|
||||||
if (!aModelWorld.IsIdentity() || TransformPersistence.Flags)
|
|
||||||
{
|
|
||||||
aCtx->ApplyWorldViewMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore highlight color
|
// Restore highlight color
|
||||||
theWorkspace->HighlightColor = aHighlightColor;
|
theWorkspace->HighlightColor = aHighlightColor;
|
||||||
|
27
tests/bugs/vis/bug26538
Executable file
27
tests/bugs/vis/bug26538
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC26538"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Visualization - Infinite growth of maxtrix stack in OpenGl_Structure::Render
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
box b1 1 1 1
|
||||||
|
box b2 1 1 1
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vdisplay b1
|
||||||
|
vdisplay b2
|
||||||
|
vsetlocation b2 10 10 10
|
||||||
|
vfit
|
||||||
|
|
||||||
|
set listmem {}
|
||||||
|
|
||||||
|
set i_max 3
|
||||||
|
for {set i 1} {${i} <= ${i_max}} {incr i} {
|
||||||
|
vfps 1000
|
||||||
|
lappend listmem [meminfo h]
|
||||||
|
checktrend $listmem 0 1 "Memory leak detected"
|
||||||
|
}
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}.png
|
Loading…
x
Reference in New Issue
Block a user