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 

Geometry in world coordinates but with same screen size - how to do?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Wed Jan 18, 2017 8:43 am    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

Hi guys,

I'm trying desperately for hours now and I'm not able to achieve the following. : (

I have a geometry, a 2D cross mark (everything is 2D), and I would like it to stick at specific world coordinates and in addition have always the same screen size, no matter what the zoom level is.

I thought AutoTransform should do the job, but somehow it doesn't : ( And sadly osg::AutoTransform is more or less not documented at all regarding what which feature does : (

This is what I have tried and I thought it should have work:

Code:

osg::ref_ptr<osg::AutoTransform> auto_transform = new osg::AutoTransform();
auto_transform->addChild(cross_mark_geode);
auto_transform->setAutoScaleToScreen(true);
root->addChild(auto_transform);


Any idea how I could make it work?

Many many thanks in advance!

Cheers,
Roko
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Wed Jan 18, 2017 10:12 am    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

Hi Roko,

Have a look at the osgautotransform example as this is both a unit
test and means of illustrating how to use it.

FYI, the coordinates of the subgraph of the AutoTransform are scaled
to screen coords, so a subgraph of 10 units across will be scaled to
10 pixels on screen.

Robert.

On 18 January 2017 at 08:44, Roko Talk <> wrote:
Quote:
Hi guys,

I'm now trying desperately for hours now and not able to achieve the following. : (

I have a geometry, a 2D cross mark (everything is 2D), and I would like it to stick at specific world coordinates and in addition have always the same screen size, no matter what the zoom level is. I thought AutoTransform should do it, but somehow it doesn't the job : ( (And sadly osg::AutoTransform is more or less not documented at all what which feature does : ( )

This is what I have tried and I thought it should work:


Code:

osg::ref_ptr<osg::AutoTransform> auto_transform = new osg::AutoTransform();
auto_transform->addChild(cross_mark_geode);
auto_transform->setAutoScaleToScreen(true);
root->addChild(auto_transform);




Any idea how I could make it work?

Many many thanks in advance!

Cheers,
Roko

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69986#69986








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Wed Jan 18, 2017 2:49 pm    Post subject:
Reply with quote

Hi Robert,

Many thanks for the fast reply!

Do I understand correctly that the example contains exactly the case I'm looking for? Or just something close to what I'm looking for?

And I have no idea what to do with you FYI ^^' - I assume it is relevant to my problem, but do you mind to explain it a slightly bit more? - Sorry for the inconvenience!

Many thanks!

Cheers,
Roko
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Wed Jan 18, 2017 4:18 pm    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

On 18 January 2017 at 14:49, Roko Talk <> wrote:
Quote:
Hi Robert,

Many thanks for the fast reply!

Do I understand correctly that the example contains exactly the case I'm looking for? Or just something close to what I'm looking for?

The example doesn't do *exactly* what you are after, but it's an
example, look at it, run the example, learn what you can.

Quote:
And I have no idea what to do with you FYI ^^' -

FYI -> For Your Information.

Quote:
I assume it is relevant to my problem, but do you mind to explain it a slightly bit more? - Sorry for the inconvenience!

I don't know what part you are struggling to understand so don't know
how to go about explaining more to resolve this.

As a general note, I'm happy point users in the right direction, but I
do this support for free, I'm not going to write your code for you or
walk your through every line of code.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Wed Jan 18, 2017 4:20 pm    Post subject:
Reply with quote

Hey Robert,

many thanks for your fast reply again! I really don't assume you to write my code for me. But could you please give me a helping hand what I have to combine to achieve want I want? I run the whole example, I saw everything, but as you already pointed out none of them does what I'm looking for.

I have the feeling I am unable to see the wood for the trees. As none of the stuff in the example has a constant size I'm struggling extrapolating this information out of it. Do you mind to give me a hint which features I have to combine to achieve what I want?

Many many thanks again!
Roko

Edit: Is all the information I need to achieve my goal in the example or do I have to combine this example with other examples to achieve what I want?
Back to top
View user's profile Send private message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Thu Jan 19, 2017 3:34 pm    Post subject:
Reply with quote

Hey guys,

does any one else has maybe an idea? : )


Many thanks!

Cheers,
Roko
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Jan 19, 2017 4:59 pm    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

On 19 January 2017 at 15:34, Roko Talk <> wrote:
Quote:
does any one else has maybe an idea? : )

I suspect others will be like myself and unable to guess what bit you
are struggling to get working and what you don't understand. Why not
create a small example, such as by modifying an existing one like
osgautottransform that illustrates your usage case and then others
will be able to see what you are doing and what the results are, and
what you are doing wrong.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Thu Jan 19, 2017 7:44 pm    Post subject:
Reply with quote

Hey Robert,

I thought it is clear what I'm struggling with. I'm able to reproduce the whole osgautotransform example. Also I'm able to reproduce it with a geometry geode. But I'm struggling with what functionalities I have to combine to be able to let my geometry geode have a constant screen size, independent from the zoom level, BUT fix world coordinates.

The stuff in the osgautotransform example comes close to it, but it still changes the size when I'm zooming out.

So my question is, what do I have to combine to have a geometry geode have a constant screen size and fixed world coordinates. I guess half of it will be osgautotransform, what would be the other half?

Please let me know what you expect from a provided example. The example would just be a geometry geode and on it applied the features from the osgautotransform example. Therefore I am able to reproduce the stuff from the osgautotransform example, but how could I make it not to change in screen size?


Many thanks in advance : )


Roko

Cheers,
Roko
Back to top
View user's profile Send private message
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Fri Jan 20, 2017 12:55 am    Post subject:
Reply with quote

Ps. To specify what I'm exactly looking for, it is an equivalent for osg::Geometry of the following stuff for osgText::TextBase:::

Code:

CharacterSizeMode OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT


I hope now it is clear what I'm looking for Smile
Back to top
View user's profile Send private message
tianzjyh
Guest





PostPosted: Fri Jan 20, 2017 1:52 am    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

hi, Roko,
The example "osgautotransform" demonstrates different kinds of text auto-transform, e.g. ranged min-scale, max-scale, fixed position. If you are not sure about the implementation inside the source code, just try to combine the different kinds of texts inside the example, and you will get your wanted text.



--




Cheers,
---
TianZJ




Quote:
At 2017-01-20 08:55:08, "Roko Talk" <> wrote:
Quote:
Ps. To specify what I'm exactly looking for, it is an equivalent for osg::Geometry of the following stuff for osgText::TextBase:::


Code:

CharacterSizeMode OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT




I hope now it is clear what I'm looking for :)

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70014#70014








------------------
Post generated by Mail2Forum
Back to top
Roko
Newbie


Joined: 18 Jan 2017
Posts: 9

PostPosted: Fri Jan 20, 2017 2:10 am    Post subject:
Reply with quote

Hi TianZJ,

thank you for your reply Smile - Are you sure combining stuff from within the osgautotransform example is enough to achieve what I want for osg::Geometry? Because for text I can realize it with the above posted command.

Many thanks! Smile

Cheers,
Roko
Back to top
View user's profile Send private message
tianzjyh
Guest





PostPosted: Fri Jan 20, 2017 3:23 am    Post subject:
Geometry in world coordinates but with same screen size - how to do?
Reply with quote

Hi, Roko,
Just check function osg::AutoTransform::setPosition(const Vec3d& pos), and try setting "pos" to (0,0,0), then maybe you will find a clue.




--




Cheers,
---
TianZJ




Quote:
At 2017-01-20 10:10:31, "Roko Talk" <> wrote:
Quote:
Hi TianZJ,

thank you for your reply Smile - Are you sure combining stuff from within the osgautotransform example is enough to achieve what I want for osg::Geometry? Because for text I can realize it with the above posted command.

Many thanks! :)

Cheers,
Roko

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70016#70016








------------------
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 Mapping texture coordinates to a port... ijwolf8 General 0 Thu Oct 25, 2018 8:11 pm View latest post
No new posts osg::Drawable vs osg::Geometry NoeMurr General 2 Sun Oct 21, 2018 2:45 pm View latest post
No new posts Absolute final world position matrix ... Steal General 1 Mon Sep 24, 2018 11:25 am View latest post
No new posts Load an obj file and mapping a given ... aaa3d General 3 Mon Aug 06, 2018 2:27 pm View latest post
No new posts [HELP] Properly using osg::VertexAttr... ppsychrite General 3 Wed Aug 01, 2018 12:17 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