- const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker(Standard_True);
- const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
- Handle(OpenGl_View) aView = theWorkspace->ActiveView();
-
- double aScale = aView->Camera()->Scale();
- if (!updatePoints(MyDist * aScale))
- return;
-
- Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();
-
- if (myVboAttribs.IsNull()) {
- myVboAttribs = new SketcherPrs_VertexBuffer(*aAttribs);
- }
-
- 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;
-
- if (toHilight)
- aCtx->core11fwd->glDisable (GL_LIGHTING);
- else
- aCtx->core11fwd->glEnable (GL_LIGHTING);
-
- 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);
- }
- theWorkspace->EnableTexture (aTextureBack);
- aCtx->BindProgram (NULL);
-
- // Update selection position only if there is no selected object
- // because it can corrupt selection of other objects
- if ((GetContext()->NbCurrents() == 0) && (GetContext()->NbSelected() == 0))
- {
- GetContext()->MainSelector()->RebuildSensitivesTree (this);
- GetContext()->MainSelector()->RebuildObjectsTree (false);
- }
-}
-
-
-void SketcherPrs_SymbolPrs::Release (OpenGl_Context* theContext)
-{
- if (!myVboAttribs.IsNull()) {
- if (theContext) {
- theContext->DelayedRelease (myVboAttribs);
+ myIsCustomColor = !theColor.empty();
+ if (myIsCustomColor)
+ myCustomColor = Quantity_Color(theColor[0] / 255., theColor[1] / 255.,
+ theColor[2] / 255., Quantity_TOC_RGB);
+ else
+ myCustomColor = Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB);
+
+ if (!myAspect.IsNull())
+ myAspect->SetColor (myCustomColor);
+
+ Handle(Prs3d_Presentation) aPrs = Presentation();
+ if (!aPrs.IsNull()) {
+ if (myIsCustomColor) {
+ Handle(Graphic3d_PresentationAttributes) aAttr = new Graphic3d_PresentationAttributes();
+ aAttr->SetColor(myCustomColor);
+ aPrs->Highlight(aAttr);
+ }
+ else {
+ aPrs->UnHighlight();