Re: [osg-users] Problem with a program in osg qsg

2009-09-09 Thread J.P. Delport

Hi,

Brett Thomas Lee wrote:

Hi,



Thank you! very much.I also have an another question.What is attach in

mPreRenderCamera-attach(osg::Camera::COLOR_BUFFER,img.get()); code.If I attach an image to color buffer whenever I update the camera scene does 
the image gets automatically updated??or Do I need to attach it every 
frame??


attach only once, see osgprerender example.

jp





Cheers,
Brett

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





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



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Problem with a program in osg qsg

2009-09-09 Thread Thrall, Bryan
Brett Thomas Lee wrote on Tuesday, September 08, 2009 6:49 PM:
 Thank you! very much.I also have an another question.What is attach in
 
 mPreRenderCamera-attach(osg::Camera::COLOR_BUFFER,img.get()); code.If
I
 attach an image to color buffer whenever I update the camera scene
does the
 image gets automatically updated??or Do I need to attach it every
frame??  

I'm not certain which meaning of updated you mean here, so I will
clarify: the image will not be updated during OSG's update traversal, it
is updated during the draw phase.

HTH,
-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with a program in osg qsg

2009-09-08 Thread Paul Martz
Hi Tim -- In place of viewer.updateTraversal(), simply modify your scene 
graph.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466



Tim Allen wrote:

Hi,



Thank you very much for the reply.I also have an another question , in this code

while(!viewer.done())
{
viewer.advance();
viewer.eventTraversal();
viewer.updateTraversal();
viewer.renderingTraversals();
} 
if I remove viewer.updateTraversal(); and Is there a way to update  the scene without using viewer.updateTraversal??If so how can this be done??

Cheers,
Tim


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


Re: [osg-users] Problem with a program in osg qsg

2009-09-08 Thread Thrall, Bryan
Brett Thomas Lee wrote on Tuesday, September 08, 2009 4:51 PM:

 Hi,
 
 Similar to Mr Paul I tried to modify my scene by calling update like
this
 
 viewer.realize();
 while(!viewer.done())
 {
   viewer.advance();
   viewer.eventTraversal();
 
   //viewer.updateTraversal();
   mtLeft-setUpdateCallback( new RotateCB );
   viewer.renderingTraversals();
   viewer.setCameraManipulator(new osgGA::TrackballManipulator());
 }
 
 But nothing happened!!

If you comment out the update traversal, no update callbacks will be
executed. What Paul was suggesting is doing whatever RotateCB does in
while(!viewer.done()), like so:

 viewer.realize();
 while(!viewer.done())
 {
viewer.advance();
viewer.eventTraversal();
 
//viewer.updateTraversal();
doRotateCBStuff();
viewer.renderingTraversals();
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
 }

-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with a program in osg qsg

2009-09-07 Thread Hansoo Kim

brett01 wrote:
 Hi,
 
 I am actually trying the program of callback in osg quick start guide which 
 rotates the cow using a node callback.
 
 when I change code viewer.run() to 
 while(!viewer.done())
 {
   viewer.frame();
 } 
 
 I am unable to see the models on the screen.What is the diffrence between the 
 two??
 
 Thank you!
 
 Cheers,
 Brett




Please check you've done viewer.realize(). 
viewer.run() includes realizing step.


VR Lab, Konkuk University, South Korea

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





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


Re: [osg-users] Problem with a program in osg qsg

2009-09-07 Thread Tim Allen
Hi,



Thank you very much for the reply.I also have an another question , in this code

while(!viewer.done())
{
viewer.advance();
viewer.eventTraversal();
viewer.updateTraversal();
viewer.renderingTraversals();
} 
if I remove viewer.updateTraversal(); and Is there a way to update  the scene 
without using viewer.updateTraversal??If so how can this be done??
Cheers,
Tim

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





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


Re: [osg-users] Problem with a program in osg qsg

2009-09-07 Thread Jean-Sébastien Guay

Hi Brett, Kim,


I am actually trying the program of callback in osg quick start guide which 
rotates the cow using a node callback.

when I change code viewer.run() to 
while(!viewer.done())

{
viewer.frame();
} 


I am unable to see the models on the screen.What is the diffrence between the 
two??


Please check you've done viewer.realize(). 
viewer.run() includes realizing step.


Actually, osgViewer::ViewerBase::frame() will call realize() if it 
hasn't been called yet. So that's not the problem.


You can check the source code (in this case osgViewer::ViewerBase 
contains run() and frame() methods, and osgViewer::Viewer overrides the 
run() method) to see exactly what the difference is.


In your case, the difference you're seeing is simply that 
osgViewer::run() automatically adds an osgGA::TrackballManipulator to 
the viewer, while just calling viewer.frame() yourself doesn't.


  int Viewer::run()
  {
  if (!getCameraManipulator()  getCamera()-getAllowEventFocus())
  {
  setCameraManipulator(new osgGA::TrackballManipulator());
  }

  setReleaseContextAtEndOfFrameHint(false);

  return ViewerBase::run();
  }

And the TrackballManipulator centers itself on your scene's contents by 
default on the first frame. So the effect you're seeing is just that the 
camera is not pointing towards your objects in the viewer.frame() case.


You could add a TrackballManipulator (or some other subclass of 
osgGA::MatrixManipulator) to the viewer yourself to get the same 
behavior as using run(). Or you could set the camera's view matrix 
manually in your frame loop before viewer.frame() so that the camera is 
where you want it to be for your objects to be visible. It's your choice.


That's one of the nice things with OSG development... No black box. You 
can see what everything does and how it's done, and most of the time 
it's coded in a way that's understandable by mere mortals like us (as 
opposed to some other libraries like boost :-) ).


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org