AIS_TextLabel can not display

//draw point
BRepBuilderAPI_MakeVertex ver(gp_Pnt(0,0,10));
TopoDS_Shape topo_shape = ver.Vertex();
Handle(AIS_Shape) pt_ais = new AIS_Shape(topo_shape);
mwin->myContext->Display(pt_ais,true);

//draw text
Handle(AIS_TextLabel) text_label = new AIS_TextLabel();
std::string text_ = "0.06";
TCollection_ExtendedString occ_text((Standard_CString)text_.data());
text_label->SetText(occ_text);
text_label->SetPostion(gp_Pnt(0,0,0));
mwin->myContext->Display(text_label,true);

the code before

when i show point first,the point and text can display both.

when i show text first,the text cannot display.

how can i do? I want display text after point.

Kirill Gavrilov's picture

I don't see the issue in the code from the first glance.
The Draw Harness script making similar thing works as expected:

pload MODELING VISUALIZATION
vclear
vinit View1
vdrawtext t "0.06" -pos 0 0 0 -font Arial

vertex v 0 0 10
vdisplay v
vfit

So probably your issue is somewhere around and not exactly in quoted lines.

xu weibin's picture

Hi:

You show the text first,the point second.This is right.

Can you show the point first,the text second?

The code like below:

pload MODELING VISUALIZATION 

vclear 

vinit View1 

vertex v 0 0 10 

vdisplay v 

vdrawtext t "0.06" -pos 0 0 0 -font Arial 

vfit

xu weibin's picture

I test opencascade7.3, it is OK

Opencascade 7.4 is wrong!

The Error is TKOpenGL | Type:Error|.........

This is a bug for occ7.4?

what can i do to solve this problem?

Thank you! 

Kirill Gavrilov's picture

The Error is TKOpenGL | Type:Error|.........

This is incomplete message.

You show the text first,the point second.This is right.

Test script works in any direction within OCCT 7.4.0 on my workstation.

This is a bug for occ7.4?

To make sure that this is OCCT bug, it is necessary to have a reproducer.
The error message may indicate a bug in application itself (for example - multi-threading issues).

xu weibin's picture

Hi,

This problem might have something to do with my system!

I changed a computer,it is OK.

Thank you!

jason jiang's picture

Hi:
I have a question is,if it is marked the text on a TopoDS_Shape,them,how to clear or erase the text?If I can clear the text,then,I can draw it agin on the other place.
thanks
Jason