ok, i found a way :
void display(void)
{
ViewportPtr vp = mgr->getWindow()->getPort(0);
int mx = vp->getPixelWidth()/2.0;
int my = vp->getPixelHeight()/2.0;
Line line = mgr->calcViewRay(mx,my);
Vec3f ld = line.getDirection();
ld*= -1;
Quaternion qD(Vec3f(0,0,1),ld);
Vec3f up_temp;
qD.multVec(Vec3f(0,1,0), up_temp);
Quaternion qU(up_temp, mgr->getNavigator()->getUp());
Quaternion qResult;
qResult = qU;
qResult.mult(qD);
Matrix m;
m.setRotate(qResult);
beginEditCP(theTextTrsf);
theTextTrsf->setMatrix(m);
endEditCP(theTextTrsf);
mgr->redraw();
}
and it seems to work.
any comment ?
thanks,
Stephane
>>> [EMAIL PROTECTED] 30/04/2008 13:53 >>>
hi,
I need to have text in the main 3d viewer, attached to some points of
my models.
The problem is that the text rotates with the camera.
After reading the mailing list archive, it seems the experimental code
( OSGScreenAlignedText ) cannot be used.
So I tried to rotate my text nodes before every "mgr->redraw();" by
taking the "mgr->getCamera()->getWorldToScreen" , or using the
"mgr->calcViewRay" but i cannot achieve the result I want.
can you help me with that ? I'm lost ....
( I cannot use text in foreground as the text needs to be hidden
behind
the models)
Thanks a lot.
Stephane
______________________________________________________________
Celebrating Excellence Since 1972. For more information, please visit
www.rwdi.com/35th_anniversary/.
Reputation Resources Results
http://www.rwdi.com
______________________________________________________________
This communication is intended for the sole use of the party to whom it
is addressed and may contain information that is privileged and/or
confidential. Any other distribution, copying or disclosure is strictly
prohibited. If you have received this e-mail in error, please notify us
immediately by telephone (1-519-823-1311) and delete the message without
retaining any hard or electronic copies of same.
RWDI scans outgoing emails for viruses, but makes no warranty as to
their absence in this email or attachments.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users
______________________________________________________________
Celebrating Excellence Since 1972. For more information, please visit
www.rwdi.com/35th_anniversary/.
Reputation Resources Results
http://www.rwdi.com
______________________________________________________________
This communication is intended for the sole use of the party to whom it is
addressed and may contain information that is privileged and/or confidential.
Any other distribution, copying or disclosure is strictly prohibited. If you
have received this e-mail in error, please notify us immediately by telephone
(1-519-823-1311) and delete the message without retaining any hard or
electronic copies of same.
RWDI scans outgoing emails for viruses, but makes no warranty as to their
absence in this email or attachments.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users