*/
- glPushAttrib( GL_FOG_BIT | GL_LIGHTING_BIT | GL_ENABLE_BIT );
-
// Apply Fog
if ( myFog.IsOn )
{
}
}
- /* restore previous graphics context; before update lights */
- //TsmPopAttri();
+ // Resetting GL parameters according to the default aspects
+ // in order to synchronize GL state with the graphic driver state
+ // before drawing auxiliary stuff (trihedrons, overlayer)
+ // and invoking optional callbacks
+ AWorkspace->ResetAppliedAspect();
// Disable current clipping planes
for ( planeid = GL_CLIP_PLANE0; planeid < lastid; planeid++ )
if (!myGraduatedTrihedron.IsNull())
myGraduatedTrihedron->Render(AWorkspace);
- // The applied aspects should be reset to make it possible to
- // update gl state and bring it into line with currently set
- // aspects by reapplying them. Reset should be done, because
- // the glPopAttrib() will return original gl state while the
- // internal TKOpenGl state stills unchanged.
- AWorkspace->ResetAppliedAspect();
- glPopAttrib(); // GL_FOG_BIT | GL_LIGHTING_BIT | GL_ENABLE_BIT
-
// Restore face culling
if ( myBackfacing )
{
if (!OpenGl_Window::Activate())
return Standard_False;
- NamedStatus = IsTextureEnabled() ? OPENGL_NS_TEXTURE : 0;
DegenerateModel = 0;
SkipRatio = 0.0f;
- HighlightColor = &myDefaultHighlightColor;
- AspectLine_set = &myDefaultAspectLine;
- AspectLine_applied = NULL;
- AspectFace_set = &myDefaultAspectFace;
- AspectFace_applied = NULL;
- AspectMarker_set = &myDefaultAspectMarker;
- AspectMarker_applied = NULL;
- AspectText_set = &myDefaultAspectText;
- AspectText_applied = NULL;
- TextParam_set = &myDefaultTextParam;
- TextParam_applied = NULL;
ViewMatrix_applied = &myDefaultMatrix;
StructureMatrix_applied = &myDefaultMatrix;
- PolygonOffset_applied = NULL;
- return Standard_True;
+
+ ResetAppliedAspect();
+
+ return Standard_True;
}
// =======================================================================
EraseAnimation();
}
}
+
+//=======================================================================
+//function : ResetAppliedAspect
+//purpose : Sets default values of GL parameters in accordance with default aspects
+//=======================================================================
+void OpenGl_Workspace::ResetAppliedAspect()
+{
+ NamedStatus = IsTextureEnabled() ? OPENGL_NS_TEXTURE : 0;
+ HighlightColor = &myDefaultHighlightColor;
+ AspectLine_set = &myDefaultAspectLine;
+ AspectLine_applied = NULL;
+ AspectFace_set = &myDefaultAspectFace;
+ AspectFace_applied = NULL;
+ AspectMarker_set = &myDefaultAspectMarker;
+ AspectMarker_applied = NULL;
+ AspectText_set = &myDefaultAspectText;
+ AspectText_applied = NULL;
+ TextParam_set = &myDefaultTextParam;
+ TextParam_applied = NULL;
+ PolygonOffset_applied = NULL;
+
+ AspectLine(Standard_True);
+ AspectFace(Standard_True);
+ AspectMarker(Standard_True);
+ AspectText(Standard_True);
+}
}
return AspectText_set;
}
-
-/*----------------------------------------------------------------------*/
-
-//=======================================================================
-//function : ResetAppliedAspect
-//purpose :
-//=======================================================================
-
-void OpenGl_Workspace::ResetAppliedAspect()
-{
- AspectLine_applied = NULL;
- AspectFace_applied = NULL;
- AspectMarker_applied = NULL;
- AspectText_applied = NULL;
- TextParam_applied = NULL;
-}