OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Text Bounding Box Calculation


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Daniel Emminizer, Code...
Guest





PostPosted: Mon May 14, 2018 3:03 pm    Post subject:
Text Bounding Box Calculation
Reply with quote

Hi Robert,

I hope you're not sick of hearing from me yet. I have uncovered a difference of behavior between 3.4 and 3.6 in osgText::Text's bounding box calculation. The attached program attempts to demonstrate the difference.

In one place in our application, we are trying to determine the width of a text string in model coordinates. This works well using getBoundingBox(). The problem we are seeing is if we change the text string, then call getBoundingBox() before drawImplementation() has a chance to run, the bounding box is vastly different than expected. I believe this is because computePositions() passes in 0 for the osg::State to computeMatrix().

Because of this, it's unclear when we call getBoundingBox if we're getting model coordinates or screen coordinates. (sorry, I'm not sure if that's the correct terminology)


In OSG 3.4, if you run the attached program, you'll get the same value printout before and after change. In OSG 3.6, you get a value that is vastly larger after. You can see the relevant code in TextWidthPrinter::handle(), and on the console by pressing 't' at runtime.


This is not a blocker for us because we have access to the osg::State in our code and can multiply against the correct matrix to value we need. We can #if OSG_VERSION_GREATER_THAN our code. But this change looks unintentional, so I wanted to pass along this test program that demonstrates the issue.

I hope this is helpful.

- Dan




------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11758

PostPosted: Mon May 14, 2018 3:18 pm    Post subject:
Text Bounding Box Calculation
Reply with quote

Hi Dan,

I haven't looked at the example code, currently don't have the time
available for this right away, but will give a quick reply on the
general topic. With 3.6 osgText computes the view dependent matrices
in a way that supports usage with multiple views, whereas 3.4 doesn't
handle it well at all and can end up with wrong results going to the
wrong views. For view dependent text where the actual bounding box
varies you are bit stuck on what value to use, so you have to cache
the last valid matrix available. This change can lead to differences
between versions, but the actual bounding box isn't really determinate
so I don't think there is one "correct" answer what can/should be be
done here.

Robert.

On 14 May 2018 at 16:02, Daniel Emminizer, Code 5773
<> wrote:
Quote:
Hi Robert,

I hope you're not sick of hearing from me yet. I have uncovered a difference of behavior between 3.4 and 3.6 in osgText::Text's bounding box calculation. The attached program attempts to demonstrate the difference.

In one place in our application, we are trying to determine the width of a text string in model coordinates. This works well using getBoundingBox(). The problem we are seeing is if we change the text string, then call getBoundingBox() before drawImplementation() has a chance to run, the bounding box is vastly different than expected. I believe this is because computePositions() passes in 0 for the osg::State to computeMatrix().

Because of this, it's unclear when we call getBoundingBox if we're getting model coordinates or screen coordinates. (sorry, I'm not sure if that's the correct terminology)


In OSG 3.4, if you run the attached program, you'll get the same value printout before and after change. In OSG 3.6, you get a value that is vastly larger after. You can see the relevant code in TextWidthPrinter::handle(), and on the console by pressing 't' at runtime.


This is not a blocker for us because we have access to the osg::State in our code and can multiply against the correct matrix to value we need. We can #if OSG_VERSION_GREATER_THAN our code. But this change looks unintentional, so I wanted to pass along this test program that demonstrates the issue.

I hope this is helpful.

- Dan






------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Daniel Emminizer, Code...
Guest





PostPosted: Mon May 14, 2018 3:31 pm    Post subject:
Text Bounding Box Calculation
Reply with quote

Hi Robert,

No problem. I thought that might be the answer, but I figured it was worth passing along the example just in case.

Thanks for the fast response.

- Dan


Quote:
-----Original Message-----
From: osg-users [mailto:] On
Behalf Of Robert Osfield
Sent: Monday, May 14, 2018 11:18 AM
To: OpenSceneGraph Users
Subject: Re: Text Bounding Box Calculation

Hi Dan,

I haven't looked at the example code, currently don't have the time
available for this right away, but will give a quick reply on the
general topic. With 3.6 osgText computes the view dependent matrices
in a way that supports usage with multiple views, whereas 3.4 doesn't
handle it well at all and can end up with wrong results going to the
wrong views. For view dependent text where the actual bounding box
varies you are bit stuck on what value to use, so you have to cache
the last valid matrix available. This change can lead to differences
between versions, but the actual bounding box isn't really determinate
so I don't think there is one "correct" answer what can/should be be
done here.

Robert.




------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Need your help with zNear / zFar calc... wernerM General 0 Thu May 03, 2018 1:45 pm View latest post
No new posts Encoding of text files hartwigw General 1 Sun Mar 25, 2018 3:57 pm View latest post
No new posts Problems with osgText::Text internal ... brianh General 3 Tue Mar 20, 2018 10:45 am View latest post
No new posts Hardware skinning computeBound() calc... DrPowers General 6 Thu Jan 18, 2018 4:18 pm View latest post
No new posts osgText::Text display issue (only whi... eskay187 General 5 Tue Dec 26, 2017 1:35 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP