[osg-users] Mirrored camera

Joakim Simonsson joakim at autosim.no
Mon Mar 9 02:58:39 PDT 2009



On Mon, 02 Mar 2009 15:50:41 +0100, Ufuk <ufuk.osg at gmail.com> wrote:

> Hi Joakim,
>
> in examples osgcamera, in function:
> void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool
> multipleScreens)
>
> i tried this code sample:
>
>
> if (i != 2)
>             viewer.addSlave(camera.get(),
> osg::Matrix::scale(aspectRatioScale, 1.0,
> 1.0)*osg::Matrix::translate(translate_x, 0.0, 0.0), osg::Matrix() );
>         else
>             viewer.addSlave(camera.get(), osg::Matrix::scale(-1.0 *
> aspectRatioScale, 1.0, 1.0)*osg::Matrix::translate(translate_x, 0.0,  
> 0.0),
> osg::Matrix() );
>
> camera which has id 2 become mirrored.
>
> is it something that you want?

Yes, and I have done this in my app as well. But the thing is, cow.osg  
uses double sided polygons.

If you edit cow.osg. On line 17:

  change GL_CULL_FACE OFF  to  GL_CULL_FACE ON

Then you will render the front face only.

If you then run your modded version of osgcamera, then you will see that  
the mirrored cameras render the backfaced polygons (i.e. the inside of the  
cow)

So this is not a general solution.

I will try to add unique groups that contains my shared scene graph for  
each camera, and give them different osg::FrontFace attributes. It seems  
that the stateset of the cameras are ignored for their underlying  
scenegraph. So adding groups for each camera, seems to be the only  
solution.



>
>
> On Mon, Mar 2, 2009 at 4:46 PM, Joakim Simonsson <joakim at autosim.no>  
> wrote:
>
>> On Mon, 02 Mar 2009 15:37:07 +0100, Mathias Fröhlich <
>> M.Froehlich at science-computing.de> wrote:
>>
>>
>>> Hi,
>>>
>>> On Monday 02 March 2009 15:24, Joakim Simonsson wrote:
>>>
>>>> Is it possible to use two cameras, where one is mirrored, that share  
>>>> the
>>>> same scene?
>>>>
>>> You should be able to have that attached either to the camera itself,  
>>> the
>>> mirrored one (is this true, or are the StateSets at the camera  
>>> something
>>> special - I dont remember by heart?).
>>>
>>
>> I tried to attach that stateattribute to the mirrored camera only. But  
>> it
>> does not seem to work.
>>
>>  Or attach a group to the camera that is
>>> not shared , apply that state at this group and attach the shared  
>>> graph to
>>> those two groups.
>>>
>>
>> I'll go for the group approach.
>>
>>
>> Thanks for your help.
>>
>>
>> --
>> Joakim
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the osg-users mailing list