const OpenGl_AspectLine* anAspect = theWorkspace->AspectLine (Standard_True);
#if !defined(GL_ES_VERSION_2_0)
- glPushAttrib (GL_POLYGON_BIT);
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
#endif
myVboAttribs->UnbindAttribute (aGlContext, Graphic3d_TOA_POS);
// restore line context
-#if !defined(GL_ES_VERSION_2_0)
- glPopAttrib();
-#endif
theWorkspace->SetAspectLine (anAspectLineOld);
}
|| anAspectFace->InteriorStyle() == Aspect_IS_HIDDENLINE)
{
drawEdges (anEdgeColor, theWorkspace);
+
+ #if !defined(GL_ES_VERSION_2_0)
+ // restore OpenGL polygon mode if needed
+ if (anAspectFace->InteriorStyle() >= Aspect_IS_HATCH)
+ {
+ glPolygonMode (GL_FRONT_AND_BACK,
+ anAspectFace->InteriorStyle() == Aspect_IS_POINT ? GL_POINT : GL_FILL);
+ }
+ #endif
}
}
{
theWorkspace->EnableTexture (aPrevTexture);
}
+
+ // restore Z buffer settings
+ if (theWorkspace->UseZBuffer() && theWorkspace->UseDepthTest())
+ {
+ glEnable (GL_DEPTH_TEST);
+ }
}
// =======================================================================
return aFont;
}
- Handle(OpenGl_Context) aCtx = theCtx;
- #if !defined(GL_ES_VERSION_2_0)
- glPushAttrib (GL_TEXTURE_BIT);
- #endif
aFont = new OpenGl_Font (aFontFt, theKey);
- if (!aFont->Init (aCtx))
+
+ if (!aFont->Init (theCtx))
{
- //glPopAttrib();
- //return aFont; // out of resources?
+ // out of resources?
}
- #if !defined(GL_ES_VERSION_2_0)
- glPopAttrib(); // texture bit
- #endif
- aCtx->ShareResource (theKey, aFont);
+ theCtx->ShareResource (theKey, aFont);
}
return aFont;
}
#if !defined(GL_ES_VERSION_2_0)
- // push enabled flags to the stack
- glPushAttrib (GL_ENABLE_BIT);
glDisable (GL_LIGHTING);
// setup depth test
glEnd();
glStencilFunc (GL_ALWAYS, 0, 0xFF);
- // glPopAttrib() will reset state for us
- //glDisable (GL_STENCIL_TEST);
- //if (!myIs2d) glEnable (GL_DEPTH_TEST);
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
- // revert OpenGL state
- glPopAttrib(); // enable bit
+ // reset OpenGL state
+ glDisable (GL_BLEND);
+ glDisable (GL_ALPHA_TEST);
+ glDisable (GL_STENCIL_TEST);
+ glDisable (GL_COLOR_LOGIC_OP);
// model view matrix was modified
theCtx->WorldViewState.Pop();
aCtx->ProjectionState.Pop();
aCtx->ApplyProjectionMatrix();
- if (theWorkspace->UseZBuffer())
+ if (theWorkspace->UseZBuffer() && theWorkspace->ToRedrawGL())
{
aCtx->core11fwd->glEnable (GL_DEPTH_TEST);
}
/*----------------------------------------------------------------------*/
//ExecuteViewDisplay
-void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace)& AWorkspace,
+void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate)
{
if ( myZLayers.NbStructures() <= 0 )
return;
- const Handle(OpenGl_Context)& aCtx = AWorkspace->GetGlContext();
-#if !defined(GL_ES_VERSION_2_0)
- if (aCtx->core11 != NULL)
- {
- aCtx->core11->glPushAttrib (GL_DEPTH_BUFFER_BIT);
- }
-#endif
-
- //TsmPushAttri(); /* save previous graphics context */
+ const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
- if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
+ if ( (theWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
{
#if !defined(GL_ES_VERSION_2_0)
- const int antiAliasingMode = AWorkspace->AntiAliasingMode();
+ const int anAntiAliasingMode = theWorkspace->AntiAliasingMode();
#endif
if ( !myAntiAliasing )
glDisable (GL_POINT_SMOOTH);
}
glDisable(GL_LINE_SMOOTH);
- if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
+ if( anAntiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
#endif
glBlendFunc (GL_ONE, GL_ZERO);
glDisable (GL_BLEND);
glEnable(GL_POINT_SMOOTH);
}
glEnable(GL_LINE_SMOOTH);
- if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
+ if( anAntiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
#endif
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
}
}
- myZLayers.Render (AWorkspace, theToDrawImmediate);
-
-#if !defined(GL_ES_VERSION_2_0)
- if (aCtx->core11 != NULL)
- {
- aCtx->core11->glPopAttrib();
- }
-#endif
+ myZLayers.Render (theWorkspace, theToDrawImmediate);
}
/*----------------------------------------------------------------------*/