[osg-users] Switch node, and multiple views

2011-09-26 Thread Lars Karlsson
Hi all, I have a scene graph containing a switch node (osg::Switch) having 4 
children.

What would be the best way to render this scene graph in 4 different 
views/viewports, with each child (attached under the osg::Switch) rendered in 
its own view? Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Switch node, and multiple views

2011-09-26 Thread Lars Karlsson
Hi Robert,

  Hi all, I have a scene graph containing a switch node
 (osg::Switch) having 4 children.
 
  What would be the best way to render this scene graph
 in 4 different views/viewports, with each child (attached
 under the osg::Switch) rendered in its own view? Thanks!
 
 Is it just one subgraph within the whole subgraph that you
 want to
 appear differently on each viewport or do you have four
 entirely
 different subgraphs for each view?
 
 If the former then the best way to handle this is to use a
 TraversalMask on the Camera matched to a NodeMask's in the
 scene
 graph, see osgstereoimage example, if the later use a
 osgViewer::CompositeViewer see osgcompositeviewer.
 
 Robert.


Yes, I'd like to render one single scenegraph, however four times DIFFERENTLY 
(i.e. in four different views), and of course simultaneously.

Basically, my first idea was to have one master scenegraph, and then somehow 
replicate this master to four slave subgraphs on each frame. However this 
would quickly become cumbersome, so naturally I thought there should be a 
better way

I looked quickly into TraversalMask... Is my hunch correct when I say that:

- I make all four subgraphs (under Switch
) active 

- I set their masks to 1, 2, 4, and 8 respectively

- I take cameras of each of the four views in CompositeViewer, and set their 
masks to 1, 2, 4 and 8 respectively

- now the CULL traversals for all four views will cull respective subgraphs:

- CULL for view 1 culls subgraphs 2, 3, and 4
- CULL for view 2 culls subgraphs 1, 3, and 4
- CULL for view 3 culls subgraphs 1, 2, and 4
- CULL for view 4 culls subgraphs 1, 2, and 3


Am I on the right track? Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Switch node, and multiple views

2011-09-26 Thread Lars Karlsson
Hi all, after going deeper into this matter, I realized I can't use 
TraversalMasks, because I have just 32 bits at disposal... 

I namely have an arbitrary number N of osg::Switch nodes in my scenegraph, not 
just four (I simplified the question, so as to make it easier to understand to 
people).

And in general, I have M views (not just four) into this scenegraph as well. M 
in general  N.

So basically, I have a number of switches, and an even greater number K of 
different paths realizable through these switches.

The point is, each of M views should be capable to display any of these K paths.

Any ideas or pointers as of how to architect this in OSG? Thank you.



--- On Mon, 9/26/11, Ulrich Hertlein u.hertl...@sandbox.de wrote:

 From: Ulrich Hertlein u.hertl...@sandbox.de
 Subject: Re: [osg-users] Switch node, and multiple views
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Date: Monday, September 26, 2011, 10:56 AM
 Hi Lars,
 
 On 26/09/11 11:30 , Lars Karlsson wrote:
  Yes, I'd like to render one single scenegraph, however
 four times DIFFERENTLY (i.e. in
  four different views), and of course simultaneously.
  ...
  I looked quickly into TraversalMask... Is my hunch
 correct when I say that:
  - I make all four subgraphs (under Switch) active 
  
  - I set their masks to 1, 2, 4, and 8 respectively
  
  - I take cameras of each of the four views in
 CompositeViewer, and set their masks to 1, 2, 4 and 8
 respectively
  
  - now the CULL traversals for all four views will cull
 respective subgraphs:
  
  - CULL for view 1 culls subgraphs 2, 3, and 4
  - CULL for view 2 culls subgraphs 1, 3, and 4
  - CULL for view 3 culls subgraphs 1, 2, and 4
  - CULL for view 4 culls subgraphs 1, 2, and 3
  
  Am I on the right track? Thanks!
 
 Yes, except instead of a Switch you would probably just use
 a Group for this, unless you
 want to disable/switch the subgraphs as well.
 
 Cheers,
 /ulrich
 ___
 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] Switch node, and multiple views

2011-09-26 Thread Lars Karlsson
Hi Farshid,

Interesting, thank you for the pointer.
Lars



Hi Lars,


On Mon, Sep 26, 2011 at 11:58 AM, Lars Karlsson klars3...@yahoo.com wrote:
Any ideas or pointers as of how to architect this in OSG? Thank you.


I've accomplished the same thing you are trying to do by using cull callbacks 
on each node. It gives you much more flexibility than node masks.

There are many ways to go about this. I created a custom data structure that 
stores a unique identifier for each view, and saved this data structure in the 
user data field of the cull visitor of the view. My cull callback then 
retrieves this identifier from the cull visitor and determines whether or not 
to render to the view.

My cull callback maintains a list of all the view identifiers it is either 
allowed or not allowed to render to. This way you are not limited to 32 bit 
node masks to control the rendering of nodes.

Hope this information was helpful and let me know if you would like more 
details.

Cheers,
Farshid 

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


[osg-users] Double-click events in AdapterWidget / OSGQtWidget

2011-09-26 Thread Lars Karlsson
Hi, I managed to modify AdapterWidget : public QGLWidget so that it recognizes 
double-click events as well,
by adding the associated protected method virtual void mouseDoubleClickEvent( 
QMouseEvent* event ).

However, whenever I double click within the OSGQtWidget (which inherits public 
osgViewer::Viewer, public AdapterWidget),
it not only generates osgGA::GUIEventAdapter::DOUBLECLICK event but an 
osgGA::GUIEventAdapter::PUSH event as well.

So whenever I double-click within the OSGQtWidget area, I get the following 
sequence of events:
osgGA::GUIEventAdapter::PUSH.  760 120 
osgGA::GUIEventAdapter::RELEASE osgGA::GUIEventAdapter::DOUBLECLICK:  760 120 
osgGA::GUIEventAdapter::RELEASE 
This is undesirable because my routine which handles 
osgGA::GUIEventAdapter::RELEASE event
is ALWAYS executed before my osgGA::GUIEventAdapter::DOUBLECLICK routine.

Is there a way for OSGQtWidget to recognize just the double-click, i.e. 
generate just the
osgGA::GUIEventAdapter::DOUBLECLICK event? Thanks!

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


[osg-users] Double-click events in AdapterWidget / OSGQtWidget

2011-09-26 Thread Lars Karlsson
Hi, I managed to modify AdapterWidget : public QGLWidget so that it recognizes 
double-click events as well,
by adding the associated protected method virtual void mouseDoubleClickEvent( 
QMouseEvent* event ). However, whenever I double click within the OSGQtWidget 
(which inherits public osgViewer::Viewer, public AdapterWidget),
it not only generates osgGA::GUIEventAdapter::DOUBLECLICK event but an 
osgGA::GUIEventAdapter::PUSH event as well. So whenever I double-click within 
the OSGQtWidget area, I get the following sequence of events:
osgGA::GUIEventAdapter::PUSH.  760 120 
osgGA::GUIEventAdapter::RELEASE 
osgGA::GUIEventAdapter::DOUBLECLICK:  760 120 
osgGA::GUIEventAdapter::RELEASE 
This is undesirable because my routine which handles 
osgGA::GUIEventAdapter::RELEASE event
is ALWAYS executed before my osgGA::GUIEventAdapter::DOUBLECLICK routine.

Is there a way for OSGQtWidget to recognize just the double-click, i.e. 
generate just the
osgGA::GUIEventAdapter::DOUBLECLICK event? Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Animating large time-stamped series of data?

2009-06-11 Thread Lars Karlsson

Hi all, what would be the best approach to animate huge time-stamped series of 
data in OSG? The data is in the format:

 (t0, x,y,z)
 (t1, x,y,z)
 (t2, x,y,z)
 ...

I have hundreds of thousands of these tuples in a typical input file. The 
tuples themselves were generated using a physical simulation program; to keep 
things simple, one can presume that every tuple represents the center of a 
physically simulated bouncing ball. 

Also, is there a way to support commands like FF, Play, Reverse Play, Stop, 
Pause, and Reverse?

Thanks for any pointers in the right direction, Lars.


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


[osg-users] Multi-pass rendering

2008-05-25 Thread Lars Karlsson
Hi,
In my application, I have to perform the following operations:

1) render the scene into buffer A, using fixed GL pipeline

2) render the scene again into buffer B, using some shaders

3) render the scene again into the color framebuffer, using some shaders

4) superimpose (i.e. lay over) additional GL primitives over the color 
framebuffer, using fixed GL functionality.

My question is, how to implement this sequence of operations (which have to be 
executed in the given order, for each frame)
using OpenSceneGraph? Any hint is welcome, because I really don't know where to 
start and how to approach the problem. Thanks Lars.


  

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


Re: [osg-users] Multi-pass rendering

2008-05-25 Thread Lars Karlsson
Robert,
I'll start with the samples you mentioned.
Thanks,
Lars



 Hi Lars,
 
 The OSG support multi-pass, multi-stage rendering pretty
 thoroughly.
 There are plenty of examples that use various combinations
 of
 multi-pass.  For starters have a look at the osgprerender,
 osgprerendercubemap, osgdistortion and osghud examples.
 
 Robert.



  

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


[osg-users] Item buffer for lines in OSG

2008-05-22 Thread Lars Karlsson
Hi,

apologies for a relatively long post


I have an old OpenGL application which uses a so-called item buffer for lines.
This buffer is based on the idea to associate, upon loading, unique IDs to all 
the lines in the 3D model, then (on each frame) to:

- render all these lines (each with a different color) into this item buffer, 
  with z-test on and lighting off (in order to preserve lines' colors),

- scan the item buffer in order to detect the lines visible in the current 
frame.
  (Since the line colors are unique, a line is visible if it has at least
  one pixel in this item buffer.) Finally, I 

- render these lines (visible in the current frame) into 
  the color framebuffer.


Now, since my 3D models are getting big, I decided to use OpenSceneGraph 2.4
in order to optimize the processing using occlusion culling, state
sorting and other nice features of scene graphs.


However, where to start? OSG Quick
Guide did not help, so any tips would be welcome. My first idea is to:

- write my own plugin which reads an .osg 3D model and extracts the lines
  of the model into a separate data structure, because it seems that .osg 
  file format does not enforce serialization of lines

- associate unique IDs (which are in 1-1 mapping with unique colors)
  to the extracted lines 

- pre-render the model (z-buffer on, lighting off, with polygons in black) 
  into a  osg::Camera::FRAME_BUFFER_OBJECT

- scan each pixel of the osg::Camera::FRAME_BUFFER_OBJECT to extract currently 
visible
  lines, and place them into a separate vector

- render this vector (this means that I won't use the scene graph at
  all for final rendering)


Any tips?

Thanks, Lars


  

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