- const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker(Standard_True);
- const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
- Handle(OpenGl_View) aView = theWorkspace->ActiveView();
-
- // ShaperModification:start
- double aScale = aView->Camera()->Scale();
- // Update points coordinate taking the viewer scale into account
- if (!updatePoints(MyDist * aScale))
- return;
- // ShaperModification:end
-
- Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();
-
- if (myVboAttribs.IsNull()) {
- myVboAttribs = new SketcherPrs_VertexBuffer(*aAttribs);
- }
-
- // Update drawing attributes
- 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()) {
- // ShaperModification:start : filling the presentation with color if there is a conflict
- const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting;
- // ShaperModification:end
-
- 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;
-
- // Set lighting of the symbol
- 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)
-{
- // Release OpenGl resources
- if (!myVboAttribs.IsNull()) {
- if (theContext) {
- theContext->DelayedRelease (myVboAttribs);
- }
- myVboAttribs.Nullify();
- }