Wed, 10/04/2006 - 09:53
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
Anjul
Wed, 11/08/2006 - 10:19
Hello Anjul,
Thank you for noticing and reporting this problem. It is now registered as a bug OCC13611 "Bug in opencascade6.1 in displaying both Text and Texture". We hope that the problem will be fixed in one of the next releases of Open CASCADE Technology - for the list of bugs fixed please check the Release Notes at http://www.opencascade.org/getocc/whatsnew/.
Best regards,
Forum Supervisor
Wed, 02/28/2007 - 23:31
I was able to fix a similar problem by commenting out lines 526 & 527 in OpenGl_TextureBox.c:
526:
if ((current_texture_data!=textab[ID].data)||
527:
(current_context!=Context))
This forces the texture to always bind.