Re: [osg-users] How to hide (make invisible) some HUD overlays in some views?

2011-10-18 Thread Atilla Selem

 Maybe I'm missing something, but wouldn't you dedicate a nodemask bit to 
 flagging your
 HUD elements, and then use a cull mask on the main View's camera that selects 
 the HUD, and
 leave that bit off the other View's cameras?


Hi Chris,
Thanks for ur reply. As you said i put a node mask for each HUD then use a 
VIEWPORT_CULL_MASK which contains all the bits for each HUD mask. i set my 
view's camera setCullMask like this;


Code:

#define HUD_MASK_LEFT 0x0001
#define HUD_MASK_INFO 0x0010
#define VIEWPORT_CULL_MASK 0x0011
...
..
pHudCameraLeft-setNodeMask(HUD_MASK_LEFT);
..
pHudCameraInfo-setNodeMask(HUD_MASK_INFO);
..
pNewSmallView-setCullMask(~VIEWPORT_CULL_MASK); // don't forget to negate cull 
mask.





Now everthing works fine.. :)

Thanks indeed.

Regards,

Atilla.

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to hide (make invisible) some HUD overlays in some views?

2011-10-17 Thread Atilla Selem
Hi,

i have an Osg application to construct my scene i'm using CompositeViewer. i 
have a main view and whenever user wishes there are some small views 
(viewports) on top right side of my main window. There is no multiple windows, 
just main scene view and other small views rendered on main view.
i also have same HUD ovelays giving information whenever user picks an object 
on main view. My problem is to hide those overlays from small views when user 
opens those views for viewing an object in detail. But overlays displayed in 
main view also appears on small views.
How can i hide those HUD overlays in those small views?

Should i register to camera post draw callback when i create small views and 
node mask HUD overlay? İf so, which callback should i use?
Or is there another way to make those overlays visible in main view but 
invisible on other views?
i could not find any other post regarding solution? Do u know related posts?


Thank you!

Cheers,
Atilla

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to hide (make invisible) some HUD overlays in some views?

2011-10-17 Thread Robert Osfield
Hi Atilla,

I'm not entirely clear on how you are managing things, but it sounds
like you might be able to use fine grained control over the render
order of the various Camera's on the GraphicWindow to make sure that
the views that you don't want overlayed are drawn last.  See
osg::Camera::setRenderOrder().

Robert.

On Mon, Oct 17, 2011 at 2:37 PM, Atilla Selem ase...@havelsan.com.tr wrote:
 Hi,

 i have an Osg application to construct my scene i'm using CompositeViewer. i 
 have a main view and whenever user wishes there are some small views 
 (viewports) on top right side of my main window. There is no multiple 
 windows, just main scene view and other small views rendered on main view.
 i also have same HUD ovelays giving information whenever user picks an object 
 on main view. My problem is to hide those overlays from small views when user 
 opens those views for viewing an object in detail. But overlays displayed in 
 main view also appears on small views.
 How can i hide those HUD overlays in those small views?

 Should i register to camera post draw callback when i create small views and 
 node mask HUD overlay? İf so, which callback should i use?
 Or is there another way to make those overlays visible in main view but 
 invisible on other views?
 i could not find any other post regarding solution? Do u know related posts?


 Thank you!

 Cheers,
 Atilla

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





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to hide (make invisible) some HUD overlays in some views?

2011-10-17 Thread Atilla Selem
Hi robert,

Views and HUD camera creation orders are as follows:
1- create main view. ( No overlays. just terrain and objects on terrain )


Code:

osgViewer::View* MyOsgQtGlCompositeViewer::createCompositeView( Group* pScene, 
bool bMainView /*= true*/, osg::Node* pNode /*= NULL*/ )
{
osgViewer::View* pNewView = new osgViewer::View;
pNewView = new osgViewer::View;
pNewView-getCamera()-setGraphicsContext(this-getGraphicsWindow());
pNewView-getCamera()-setProjectionMatrixAsPerspective(45.0f, 
static_castdouble(m_uiWidth)/static_castdouble(m_uiHeight), 1.0, 
20.0);

if(bMainView)
{
pNewView-getCamera()-setViewport(new osg::Viewport(m_uiX, m_uiY, 
m_uiWidth, m_uiHeight));
 }
else
{
m_uiX = m_uiWidth / 4;
m_uiY = m_uiHeight / 3;
unsigned int uiPortX = m_uiWidth-m_uiX;
unsigned int uiPortY = m_uiHeight-(m_iZoomViewNum * m_uiY);
pNewView-getCamera()-setViewport(new osg::Viewport(uiPortX, uiPortY, 
m_uiX, m_uiY));
}

pNewView-setSceneData(pScene); [b]// pScene is the Root group node.[/b]
addView(pNewView);
return pNewView;
}



2- create HUD cameras and display Ortographic overlay at top left side of main 
view when user picks an object on terrain. Multiple cameras are created and can 
be added to root object. Root object is where main camera and other views 
camera's starts to render. 


Code:
  void createHudInfo()
  {
  m_pCameraHUD = createHudInfoCamera(pSceneManager-get3DViewPort());
  pSceneManager-getRoot()-addChild(m_pCameraHUD);
  }





Code:
osg::Camera* createHudInfoCamera(Viewport* pViewPort)
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setProjectionMatrix(osg::Matrix::ortho2D(int(pViewPort-x()), 
int(pViewPort-width()), int(pViewPort-y()), 
int(pViewPort-height(;
m_position.set(0, 280, 0);
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setViewMatrix(osg::Matrix::identity());
camera-setClearMask(GL_DEPTH_BUFFER_BIT);
camera-setRenderOrder([b]osg::Camera::POST_RENDER[/b]);
camera-setAllowEventFocus(false);
camera-getOrCreateStateSet()-setMode(GL_LIGHTING, 
osg::StateAttribute::OFF);
return camera.release();
}



3- create a view when user wants to node track a flying object. At that time, a 
view is created at right top side of window. 2D ortographic overlay is being 
displayed on that view too. This is not a surprise becouse last view created 
renders same root which main view is set to render. So all overlays is also 
displayed on small views.


Code:

void MySceneManager::createMy3dViewPort( )
{
osgViewer::View* pItesView = NULL;
pItesView = 
m_pMyOsgCompositeViewer-[b]createCompositeView[/b](m_pOsgRoot, false, NULL);

pItesView-getCamera()-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);

}



According to your comments where should i use 
camera-SetRenderOrder(..) ?
in small view's camera?

HUD camera is set to POST_RENDER to make itself render over 2D display. But i 
don't use any render order for small views created whenever user clicks an 
aircraft and requests a custom view. i can't put a screen shot becouse code is 
classified. But screen is like when an osg user clicks 'S' sequentially and 
Statistics overlays appear on top left side. Consider that all stats overlays 
appear on main view also appears on custom small views on top right side.

Thank you!

Regards..
Atilla

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to hide (make invisible) some HUD overlays in some views?

2011-10-17 Thread Chris 'Xenon' Hanson
On 10/17/2011 7:37 AM, Atilla Selem wrote:
 i have an Osg application to construct my scene i'm using CompositeViewer. i 
 have a main view and whenever user wishes there are some small views 
 (viewports) on top right side of my main window. There is no multiple 
 windows, just main scene view and other small views rendered on main view.
 i also have same HUD ovelays giving information whenever user picks an object 
 on main view. My problem is to hide those overlays from small views when user 
 opens those views for viewing an object in detail. But overlays displayed in 
 main view also appears on small views.
 How can i hide those HUD overlays in those small views?
 Should i register to camera post draw callback when i create small views and 
 node mask HUD overlay? İf so, which callback should i use?
 Or is there another way to make those overlays visible in main view but 
 invisible on other views?
 i could not find any other post regarding solution? Do u know related posts?

  Maybe I'm missing something, but wouldn't you dedicate a nodemask bit to 
flagging your
HUD elements, and then use a cull mask on the main View's camera that selects 
the HUD, and
leave that bit off the other View's cameras?

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org