- if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements, aAttribs->Data(), GL_NONE, aAttribs->Stride)) {
- myVboAttribs->Release (aCtx.operator->());
- myVboAttribs.Nullify();
- return;
- }
-
- Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
-
- const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes(aCtx);
-
- if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) {
- const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0;
- const Handle(OpenGl_PointSprite)& aSprite = (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())
- ? anAspectMarker->SpriteHighlightRes(aCtx)
- : aSpriteNorm;
- theWorkspace->EnableTexture (aSprite);
- aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False, Standard_False, anAspectMarker->ShaderProgramRes(aCtx));
- const TEL_COLOUR* aLineColor = &anAspectMarker->Color();
- if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
- aLineColor = theWorkspace->HighlightColor;
-
- aCtx->SetColor4fv(*(const OpenGl_Vec4* )(aLineColor->rgb));
-
-
- myVboAttribs->BindAllAttributes(aCtx);
- // Textured markers will be drawn with the point sprites
- aCtx->SetPointSize (anAspectMarker->MarkerSize());
- aCtx->core11fwd->glEnable (GL_ALPHA_TEST);
- aCtx->core11fwd->glAlphaFunc (GL_GEQUAL, 0.1f);
-
- aCtx->core11fwd->glEnable (GL_BLEND);
- aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- aCtx->core11fwd->glDrawArrays (0, 0, myVboAttribs->GetElemsNb());
-
- aCtx->core11fwd->glDisable (GL_BLEND);
- aCtx->core11fwd->glDisable (GL_ALPHA_TEST);
- aCtx->SetPointSize (1.0f);
+//*********************************************************************************
+void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
+ const Handle(Prs3d_Presentation)& thePrs,
+ Quantity_Color theColor) const
+{
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
+ new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
+
+ Handle(Prs3d_LineAspect) aLinesStyle = myDrawer->LineAspect();
+ Handle(Graphic3d_AspectLine3d) aOldStyle = aLinesStyle->Aspect();
+ aLinesStyle->SetAspect(aLineAspect);
+ myDrawer->SetLineAspect(aLinesStyle);
+
+ if (theShape->isEdge()) {
+ // The shape is edge
+ std::shared_ptr<GeomAPI_Curve> aCurve =
+ std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(theShape));
+ if (aCurve->isLine()) {
+ // The shape is line
+ GeomAdaptor_Curve
+ aCurv(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
+ StdPrs_Curve::Add(thePrs, aCurv, myDrawer);
+ } else {
+ // The shape is circle or arc
+ GeomAdaptor_Curve
+ aAdaptor(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
+ StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
+ }
+ } else if (theShape->isVertex()) {
+ // draw vertex
+ std::shared_ptr<GeomAPI_Vertex> aVertex =
+ std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(theShape));
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
+ Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
+ StdPrs_Point::Add(thePrs, aPoint, myDrawer);