-
-void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
-{
- 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;
-
- 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()->RecomputeSelectionOnly(this);
-}
-
-
-void SketcherPrs_SymbolPrs::Release (OpenGl_Context* theContext)