Hi,
I am facing one problem in displaying text when textured mode is enabled.I want to display text on Textured shape when the mouse rolls over it. The code which I have written for displaying the AISTextured box and highlighting the text is given below:
gp_Pnt pnt(100,100,100);
TopoDS_Shape theBox = BRepPrimAPI_MakeBox(pnt,500,500,500);
Handle(AISTextureShape) m_AISTShape = new AISTextureShape(theBox);
TCollection_AsciiString TFileName("blablabla");
m_AISTShape->SetTextureFileName(TFileName);
m_AISTShape->SetTextureMapOn();
m_AISTShape->SetTextureScale(Standard_True, 1, 1);
m_AISTShape->SetTextureRepeat(Standard_True, 3, 3);
m_AISTShape->SetTextureOrigin(Standard_True, 0, 0);
m_AISTShape->SetDisplayMode(3);
m_hAISContext->Display(m_AISTShape,Standard_False);
m_hAISContext->UpdateCurrentViewer();
I am able to draw the Box having texture. For highlighting the text I am overriding the Compute function of AISTextureShape as below
void AISTextureShape::Compute(const Handle(PrsMgr_PresentationManager3d)& p_pPrsManager,const Handle(Prs3d_Presentation)& p_pPrs,const Standard_Integer p_iMode){
switch (p_iMode) {
case 0: // Wireframe
{
p_pPrs->Clear();
gp_Pnt l_PrsPnt = GetPrsPoint();
StdPrs_WFDeflectionShape::
Add(p_pPrs,myshape,myDrawer);
TCollection_ExtendedString l_TCoText =
TCollection_ExtendedString(m_strTextName);
Prs3d_Text::Draw(p_pPrs,myDrawer,l_TCoText,
l_PrsPnt);
}
break;
default:
AIS_TexturedShape::Compute( p_pPrsManager,
p_pPrs, p_iMode);
break;
} // end switch
}
but the problem I am facing is this that highlighted text becomes a blue box when I roll the mouse cursor over the box and the box looses its texture property.
I tried a lot to resolve this problem but I didn't get any solution. I think this a bug in opencascade. if any body knows then please help me how to resolve this problem.
Thanks
Author