Re: [osg-users] Turning off main osgViewer camera

2009-08-12 Thread J.P. Delport

Hi,

jake chambers wrote:

Hi,

Thanks for the replies. 

Brian: when I set the nodemask on the main camera to zero it no longer renders, which is good, but the FBO no longer gets rendered (I get a totally black image in the associated osg::Image). 


JP: If I just insert my FBO into the scene (as POST_RENDER) two things happen 
when I render a frame: I get the correct image in my FBO, but the main camera 
also renders. I want to be able to choose if the the main camera should render 
or not when the FBO is in use.


I'm still confused about what you actually want to do. Would it be OK if 
the main camera image is just empty? If so, if you add the scene to your 
FBO camera (make it pre_render) and add only the node containing the FBO 
camera to your main camera, the main camera should render nothing (you 
should get the clearcolor) when you call viewer.frame(). The main camera 
would only render the scene if a scene is attached to it, it won't 
render the FBO camera's scene.




I looked at osgautocapture, but it doesn't do what I need to do because the 
main camera always renders (and has to as the saved image comes from a 
DrawCallback on the main camera).


Also see osgscreencapture and grep for screencapturehandler.

jp



I've also tried simply putting my fbo directly into the viewer with:

savedcam=osgviewer->getCamera()
osgviewer->setCamera(myfbo)
osgviewer->renderingTraversals()
osgviewer->setCamera(savedcam)

But when I do this not only do I not get an image in my FBO, but the viewer 
(with the normal camera) no longer renders afterwards.

I suspect a workable solution would be to create a duplicate Viewer, setup with 
only an FBO as the main camera, and which shares the scene  (and database 
pager, etc) with the first Viewer. Then when I need to save screenshot(s) I can 
just explicitly render with the second Viewer. But surely such a drastic 
solution shouldn't be necessary?

Thank you!

Cheers,
jake

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





___
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] Turning off main osgViewer camera

2009-08-12 Thread jake chambers
Hi,

Thanks for the replies. 

Brian: when I set the nodemask on the main camera to zero it no longer renders, 
which is good, but the FBO no longer gets rendered (I get a totally black image 
in the associated osg::Image). 

JP: If I just insert my FBO into the scene (as POST_RENDER) two things happen 
when I render a frame: I get the correct image in my FBO, but the main camera 
also renders. I want to be able to choose if the the main camera should render 
or not when the FBO is in use.

I looked at osgautocapture, but it doesn't do what I need to do because the 
main camera always renders (and has to as the saved image comes from a 
DrawCallback on the main camera).

I've also tried simply putting my fbo directly into the viewer with:

savedcam=osgviewer->getCamera()
osgviewer->setCamera(myfbo)
osgviewer->renderingTraversals()
osgviewer->setCamera(savedcam)

But when I do this not only do I not get an image in my FBO, but the viewer 
(with the normal camera) no longer renders afterwards.

I suspect a workable solution would be to create a duplicate Viewer, setup with 
only an FBO as the main camera, and which shares the scene  (and database 
pager, etc) with the first Viewer. Then when I need to save screenshot(s) I can 
just explicitly render with the second Viewer. But surely such a drastic 
solution shouldn't be necessary?

Thank you!

Cheers,
jake

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





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


Re: [osg-users] Turning off main osgViewer camera

2009-08-11 Thread Brian R Hill
Try setting the main camera node mask to 0 when you don't want it to render
and 0x when you do.

Brian

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. •
-osg-users-boun...@lists.openscenegraph.org wrote: -

To: OpenSceneGraph Users 
From: "J.P. Delport" 
Sent by: osg-users-boun...@lists.openscenegraph.org
Date: 08/11/2009 10:15AM
Subject: Re: [osg-users] Turning off main osgViewer camera

Hi,

sorry I might have answered too fast. What do you want the main camera
to render when you are taking screenshots? What is it rendering when
when you only attach the FBO camera?

AFAIK you still need to call viewer frame() to trigger the FBO, but you
can make the main camera just render nothing. If you want to run an FBO
camera without creating a window, then consider the pbuffer option for
the main frame buffer.

See also maybe the osgscreencapture example.

jp

J.P. Delport wrote:
> Hi,
>
> have a look at the osgautocapture example. Set the main camera to render
> offscreen, pbuffer.
>
> jp
>
> jake chambers wrote:
>> Hi,
>>
>> I have an application where I setup a "normal" osgViewer view with
>> setUpViewOnSingleScreen(). This works fine.
>>
>> I also create an FBO camera to which I add my scene. When I want to
>> take a screenshot of the application I call
>> osgviewer->setSceneData(myFBOCamera) and render via
>> osgviewer->eventTraversal() / updateTraversal() /
>> renderingTraversals(). After I get the screenshot I restore my normal
>> scene with osgviewer->setSceneData(mySceneData). This also works fine
>> for taking screenshots.
>>
>> What I want to do now is to turn off the "main" camera whilst I render
>> the FBO (ie if I create a lot of screenshots for a movie I don't want
>> to render to the screen). How can I turn off the main camera and
>> render only to the FBO?
>> I've tried calling osgviewer->setCamera(NULL) without sucess. Indeed
>> when I meddle with the main camera I dont get a valid image from my
>> FBO. I think this makes sense as the FBO is under the main camera(?).
>> I also tried calling osgviewer->setCamera(myFBO) but no luck that way
>> either. I also can't restore the original camera to the osgviewer.
>>
>> Perhaps I am solving the problem the wrong way - is there a better
>> method? Perhaps having two seperate osgViewer objects? But then I
>> think I have only one conceptual "View" (my FBO always shows the same
>> view as the main camera, it's only a question of if the main camera
>> should render an image or not), so having one Viewer, one View and two
>> Cameras feels correct - it's just that it doesn't work :-)
>>
>>
>> Thank you!
>>
>> Cheers,
>> jake
>>
>> --
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=16079#16079
>>
>>
>>
>>
>>
>> ___
>> 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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Turning off main osgViewer camera

2009-08-11 Thread J.P. Delport

Hi,

sorry I might have answered too fast. What do you want the main camera 
to render when you are taking screenshots? What is it rendering when 
when you only attach the FBO camera?


AFAIK you still need to call viewer frame() to trigger the FBO, but you 
can make the main camera just render nothing. If you want to run an FBO 
camera without creating a window, then consider the pbuffer option for 
the main frame buffer.


See also maybe the osgscreencapture example.

jp

J.P. Delport wrote:

Hi,

have a look at the osgautocapture example. Set the main camera to render 
offscreen, pbuffer.


jp

jake chambers wrote:

Hi,

I have an application where I setup a "normal" osgViewer view with 
setUpViewOnSingleScreen(). This works fine.


I also create an FBO camera to which I add my scene. When I want to 
take a screenshot of the application I call 
osgviewer->setSceneData(myFBOCamera) and render via 
osgviewer->eventTraversal() / updateTraversal() / 
renderingTraversals(). After I get the screenshot I restore my normal 
scene with osgviewer->setSceneData(mySceneData). This also works fine 
for taking screenshots.


What I want to do now is to turn off the "main" camera whilst I render 
the FBO (ie if I create a lot of screenshots for a movie I don't want 
to render to the screen). How can I turn off the main camera and 
render only to the FBO?
I've tried calling osgviewer->setCamera(NULL) without sucess. Indeed 
when I meddle with the main camera I dont get a valid image from my 
FBO. I think this makes sense as the FBO is under the main camera(?).
I also tried calling osgviewer->setCamera(myFBO) but no luck that way 
either. I also can't restore the original camera to the osgviewer.


Perhaps I am solving the problem the wrong way - is there a better 
method? Perhaps having two seperate osgViewer objects? But then I 
think I have only one conceptual "View" (my FBO always shows the same 
view as the main camera, it's only a question of if the main camera 
should render an image or not), so having one Viewer, one View and two 
Cameras feels correct - it's just that it doesn't work :-)



Thank you!

Cheers,
jake

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





___
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] Turning off main osgViewer camera

2009-08-11 Thread J.P. Delport

Hi,

have a look at the osgautocapture example. Set the main camera to render 
offscreen, pbuffer.


jp

jake chambers wrote:

Hi,

I have an application where I setup a "normal" osgViewer view with 
setUpViewOnSingleScreen(). This works fine.

I also create an FBO camera to which I add my scene. When I want to take a screenshot of 
the application I call osgviewer->setSceneData(myFBOCamera) and render via 
osgviewer->eventTraversal() / updateTraversal() / renderingTraversals(). After I get 
the screenshot I restore my normal scene with osgviewer->setSceneData(mySceneData). 
This also works fine for taking screenshots.

What I want to do now is to turn off the "main" camera whilst I render the FBO (ie if I create a lot of screenshots for a movie I don't want to render to the screen). How can I turn off the main camera and render only to the FBO? 

I've tried calling osgviewer->setCamera(NULL) without sucess. Indeed when I meddle with the main camera I dont get a valid image from my FBO. I think this makes sense as the FBO is under the main camera(?). 


I also tried calling osgviewer->setCamera(myFBO) but no luck that way either. I 
also can't restore the original camera to the osgviewer.

Perhaps I am solving the problem the wrong way - is there a better method? Perhaps having 
two seperate osgViewer objects? But then I think I have only one conceptual 
"View" (my FBO always shows the same view as the main camera, it's only a 
question of if the main camera should render an image or not), so having one Viewer, one 
View and two Cameras feels correct - it's just that it doesn't work :-)


Thank you!

Cheers,
jake

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





___
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


[osg-users] Turning off main osgViewer camera

2009-08-11 Thread jake chambers
Hi,

I have an application where I setup a "normal" osgViewer view with 
setUpViewOnSingleScreen(). This works fine.

I also create an FBO camera to which I add my scene. When I want to take a 
screenshot of the application I call osgviewer->setSceneData(myFBOCamera) and 
render via osgviewer->eventTraversal() / updateTraversal() / 
renderingTraversals(). After I get the screenshot I restore my normal scene 
with osgviewer->setSceneData(mySceneData). This also works fine for taking 
screenshots.

What I want to do now is to turn off the "main" camera whilst I render the FBO 
(ie if I create a lot of screenshots for a movie I don't want to render to the 
screen). How can I turn off the main camera and render only to the FBO? 

I've tried calling osgviewer->setCamera(NULL) without sucess. Indeed when I 
meddle with the main camera I dont get a valid image from my FBO. I think this 
makes sense as the FBO is under the main camera(?). 

I also tried calling osgviewer->setCamera(myFBO) but no luck that way either. I 
also can't restore the original camera to the osgviewer.

Perhaps I am solving the problem the wrong way - is there a better method? 
Perhaps having two seperate osgViewer objects? But then I think I have only one 
conceptual "View" (my FBO always shows the same view as the main camera, it's 
only a question of if the main camera should render an image or not), so having 
one Viewer, one View and two Cameras feels correct - it's just that it doesn't 
work :-)


Thank you!

Cheers,
jake

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





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