Handle(OpenGl_VertexBuffer)& aVerts = myVertsVbo.ChangeValue (anIter);
Handle(OpenGl_VertexBuffer)& aTCrds = myTCrdsVbo.ChangeValue (anIter);
- if (theCtx)
+ if (theCtx != NULL)
{
theCtx->DelayedRelease (aVerts);
theCtx->DelayedRelease (aTCrds);
aVerts.Nullify();
aTCrds.Nullify();
}
+ if (theCtx != NULL
+ && !myBndVertsVbo.IsNull())
+ {
+ theCtx->DelayedRelease (myBndVertsVbo);
+ }
+
myTextures.Clear();
myVertsVbo.Clear();
myTCrdsVbo.Clear();
+ myBndVertsVbo.Nullify();
}
// =======================================================================
releaseVbos (theCtx);
if (!myFont.IsNull())
{
- Handle(OpenGl_Context) aCtx = theCtx;
const TCollection_AsciiString aKey = myFont->ResourceKey();
myFont.Nullify();
- if (! aCtx.IsNull())
- aCtx->ReleaseResource (aKey, Standard_True);
+ if (theCtx != NULL)
+ {
+ theCtx->ReleaseResource (aKey, Standard_True);
+ }
}
}
return aFont;
}
+// =======================================================================
+// function : drawRect
+// purpose :
+// =======================================================================
+void OpenGl_Text::drawRect (const Handle(OpenGl_Context)& theCtx,
+ const OpenGl_AspectText& theTextAspect,
+ const OpenGl_Vec4& theColorSubs) const
+{
+ Handle(OpenGl_ShaderProgram) aPrevProgram = theCtx->ActiveProgram();
+ if (myBndVertsVbo.IsNull())
+ {
+ OpenGl_Vec2 aQuad[4] =
+ {
+ OpenGl_Vec2(myBndBox.Right, myBndBox.Bottom),
+ OpenGl_Vec2(myBndBox.Right, myBndBox.Top),
+ OpenGl_Vec2(myBndBox.Left, myBndBox.Bottom),
+ OpenGl_Vec2(myBndBox.Left, myBndBox.Top)
+ };
+ myBndVertsVbo = new OpenGl_VertexBuffer();
+ myBndVertsVbo->Init (theCtx, 2, 4, aQuad[0].GetData());
+ }
+
+ if (theCtx->core20fwd != NULL)
+ {
+ // bind flat program
+ theCtx->ShaderManager()->BindFaceProgram (Handle(OpenGl_Texture)(), Standard_False, Standard_False, Standard_False, Handle(OpenGl_ShaderProgram)());
+ }
+#if !defined(GL_ES_VERSION_2_0)
+ if (theCtx->core11 != NULL
+ && theCtx->ActiveProgram().IsNull())
+ {
+ glBindTexture (GL_TEXTURE_2D, 0);
+ }
+#endif
+ theCtx->SetColor4fv (theColorSubs);
+ setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
+ myBndVertsVbo->BindAttribute (theCtx, Graphic3d_TOA_POS);
+
+ theCtx->core20fwd->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
+
+ myBndVertsVbo->UnbindAttribute (theCtx, Graphic3d_TOA_POS);
+ theCtx->BindProgram (aPrevProgram);
+}
+
// =======================================================================
// function : render
// purpose :
myTCrdsVbo);
aFormatter.BndBox (myBndBox);
+ if (!myBndVertsVbo.IsNull())
+ {
+ myBndVertsVbo->Release (theCtx.get());
+ myBndVertsVbo.Nullify();
+ }
}
if (myTextures.IsEmpty())
}
case Aspect_TODT_SUBTITLE:
{
- #if !defined(GL_ES_VERSION_2_0)
- if (theCtx->core11 != NULL)
- {
- theCtx->SetColor4fv (theColorSubs);
- setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
-
- glBindTexture (GL_TEXTURE_2D, 0);
- glBegin (GL_QUADS);
- glVertex2f (myBndBox.Left, myBndBox.Top);
- glVertex2f (myBndBox.Right, myBndBox.Top);
- glVertex2f (myBndBox.Right, myBndBox.Bottom);
- glVertex2f (myBndBox.Left, myBndBox.Bottom);
- glEnd();
- }
- #endif
+ drawRect (theCtx, theTextAspect, theColorSubs);
break;
}
case Aspect_TODT_DEKALE:
if (theTextAspect.Aspect()->DisplayType() == Aspect_TODT_DIMENSION)
{
- setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
-
glDisable (GL_BLEND);
if (!myIs2d)
{
glStencilFunc (GL_ALWAYS, 1, 0xFF);
glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
- #if !defined(GL_ES_VERSION_2_0)
- if (theCtx->core11 != NULL)
- {
- glBegin (GL_QUADS);
- glVertex2f (myBndBox.Left, myBndBox.Top);
- glVertex2f (myBndBox.Right, myBndBox.Top);
- glVertex2f (myBndBox.Right, myBndBox.Bottom);
- glVertex2f (myBndBox.Left, myBndBox.Bottom);
- glEnd();
- }
- #endif
+ drawRect (theCtx, theTextAspect, OpenGl_Vec4 (1.0f, 1.0f, 1.0f, 1.0f));
glStencilFunc (GL_ALWAYS, 0, 0xFF);
--- /dev/null
+puts "============"
+puts "OCC28099: handle DIMENSION and SUBTITLE styles within Core Profile"
+puts "Test case prints overlay labels with different subtitle styles"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+
+vclear
+vcaps -core 1
+vinit View1
+vaxo
+vfont add [locate_data_file DejaVuSans.ttf] SansFont
+
+vdrawtext t1 "Overlay Test Blend" -2d -perspos -1 1 -pos 100 -50 0 -height 16 -font SansFont -color 1 1 0 -disptype blend -subcolor 0 0 1
+vdrawtext t2 "Overlay Test Decal" -2d -perspos -1 1 -pos 100 -100 0 -height 16 -font SansFont -color 1 1 0 -disptype decal -subcolor 0 0 1
+vdrawtext t3 "Overlay Test Subtitle" -2d -perspos -1 1 -pos 100 -150 0 -height 16 -font SansFont -color 1 1 0 -disptype subtitle -subcolor 0 0 1
+vdrawtext t4 "Overlay Test Normal" -2d -perspos -1 1 -pos 100 -200 0 -height 16 -font SansFont -color 0 1 1 -disptype normal -subcolor 0 0 1
+
+vdrawtext t5 " Overlay Test Normal \n Second line" -2d -perspos -1 1 -pos 100 -250 0 -height 16 -font SansFont -color 0 1 1 -disptype normal -subcolor 0 0 1
+vdrawtext t6 " Overlay Test Subtitle\n Second line" -2d -perspos -1 1 -pos 100 -300 0 -height 16 -font SansFont -color 1 1 0 -disptype subtitle -subcolor 0 0 1
+vdrawtext t7 " Overlay Test Decal \n Second line" -2d -perspos -1 1 -pos 100 -350 0 -height 16 -font SansFont -color 1 1 0 -disptype decal -subcolor 0 0 1
+vdrawtext t8 " Overlay Test Blend \n Second line" -2d -perspos -1 1 -pos 100 -400 0 -height 16 -font SansFont -color 1 1 0 -disptype blend -subcolor 0 0 1
+
+box b 50 50 50
+vdisplay -dispMode 1 b
+
+vpoint lengthP1 0 50 50
+vpoint lengthP2 50 50 50
+vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -font SansFont
+vfit
+
+vdump $::imagedir/${::casename}.png