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 

Difficulties with HUD


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Steven Saunderson
Guest





PostPosted: Sat Nov 29, 2008 10:17 pm    Post subject:
Difficulties with HUD
Reply with quote

I've added a HUD (code based on the OSG tutorial) but it has problems.

If I setComputeNearFarMode to DO_NOT_COMPUTE_NEAR_FAR the HD background
(white in my case) appears but not the black text. Reversing the
colours doesn't help so it looks like the background is appearing on top
of the text. Is there any way (perhaps StateSet entry) to correct this ?

Also, the HUD relies on the scene lighting. This means that when I
reduce/disable the scene lights the HUD also fades to black. I'd like
the HUD contrast to be constant. Is there any way I can specify that
the HUD background is a constant white rather than being affected by the
ambient light level ?

Thanks,
Steven



------------------
Post generated by Mail2Forum
Back to top
Ulrich Hertlein
Guest





PostPosted: Sun Nov 30, 2008 12:17 am    Post subject:
Difficulties with HUD
Reply with quote

On 30/11/08 9:17 AM, Steven Saunderson wrote:
Quote:
If I setComputeNearFarMode to DO_NOT_COMPUTE_NEAR_FAR the HD background
(white in my case) appears but not the black text. Reversing the colours
doesn't help so it looks like the background is appearing on top of the
text. Is there any way (perhaps StateSet entry) to correct this ?

Have you set correct near/far values? Maybe your text is clipped by the near plane?

Quote:
Also, the HUD relies on the scene lighting. This means that when I
reduce/disable the scene lights the HUD also fades to black. I'd like
the HUD contrast to be constant. Is there any way I can specify that the
HUD background is a constant white rather than being affected by the
ambient light level ?

Disable lighting for the HUD subgraph:
stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

Cheers,
/ulrich


------------------
Post generated by Mail2Forum
Back to top
Steven Saunderson
Guest





PostPosted: Sun Nov 30, 2008 3:46 am    Post subject:
Difficulties with HUD
Reply with quote

----- From: Ulrich Hertlein at 2008-11-30 11:17-----
Quote:
On 30/11/08 9:17 AM, Steven Saunderson wrote:
Quote:
If I setComputeNearFarMode to DO_NOT_COMPUTE_NEAR_FAR the HD background
(white in my case) appears but not the black text.

Have you set correct near/far values? Maybe your text is clipped by
the near plane?

I've just tried this (and other tests). The HUD code has a Geode as the
parent for the Geometry (background) and Text (foreground). This Geode
has a StateSet that should do what I want but doesn't. If I also attach
this StateSet to the Text everything works. I thought the Text would be
affected by inheritance but apparently not. Perhaps Text has a default
StateSet that stops inheritance. So, the good news is that this is now
working.

Quote:
Quote:
Also, the HUD relies on the scene lighting. This means that when I
reduce/disable the scene lights the HUD also fades to black.

Disable lighting for the HUD subgraph:
stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

Brilliant, thank you very much. I wouldn't have realised this from
reading my OpenGL book. Presumably LIGHTING OFF means the colour
displayed is that specified with no modification. This is much better
than adding a light to the HUD (just tried and it works) because lights
are a limited resource.

Thanks,
Steven



------------------
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 Happy New Year to all OSG Users Chris Hanson General 0 Mon Jan 07, 2019 10:17 am View latest post
No new posts osg-users Digest, Vol 138, Issue 27 Zachary1234 General 0 Tue Jan 01, 2019 1:16 am View latest post
No new posts osg-users Digest, Vol 137, Issue 14 poweruserm@live.com.au General 0 Fri Nov 16, 2018 11:16 pm View latest post
No new posts General Users starting questions in O... A Z General 1 Mon Oct 15, 2018 3:59 am View latest post
No new posts osg-users Digest, Vol 136, Issue 8 jonasydy General 0 Wed Oct 10, 2018 12:40 am 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