Hello Rene,

Rene Weller wrote:
>  >>> // if you want it to work when compiling with enable_osg2_prep
>>>> rAct->setWindow(get_pointer(pwin));
>>>>
>>>> // otherwise
>>>> rAct->setWindow(pwin.getCPtr());
>>>
>>>> before the call to vpleft->render(rAct);
>>>
>>> The program crashes if I call this. However, shouldn`t 29FBOViewport
>>> produce the same warning? On my setup, it does not.
>>
>> hm, I'm wondering if this is some kind of ref count problem. The thing
>> to watch out for in 1.x is that one often uses objects with a ref
>> count
>> of 0. This is fine most of the time unless they are used in some
>> operation that temporarily increases the ref count and then drops it
>> again (back to 0) and then the object is destroyed.
>> Can you add a call to addRefCP for the global objects you have ?
> 
> I added an addRefCP to all objects but it doen`s help to avoid the 
> warnings.
> When I turn on rAct->setWindow(get_pointer(pwin));, the program crashes at
> 
> #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
> return
>    *(reinterpret_cast<FieldContainerTypeT *>(
>    Self::getElemP(Thread::getAspect())));
> 
> in function
> 
> template <class BasePtrTypeT, class FieldContainerTypeT> inline
> FieldContainerTypeT &FCPtr<BasePtrTypeT,
> FieldContainerTypeT>::operator *(void) const

hm. I'm not sure if it has anything to do with the crash you are seeing, 
but one thing that is missing is the 
Window::activate/frameInit/frameExit/deactivate around the render calls. 
Otherwise it can complain about missing extensions.

void display(void)
{
     pwin->activate();
     pwin->frameInit();

     // get the RenderAction from SimpleSceneManager
     RenderAction *rAct = static_cast<RenderAction*>(mgr->getAction());

     rAct->setWindow(get_pointer(pwin));
     // render scene from left eye
     vpleft->render(rAct);

     // render scene from right eye
     vpright->render(rAct);

     pwin->frameExit();
     pwin->deactivate();

     counter++;

     mgr->redraw();
}

>>> 29FBOViewport works fine, but my derivative only produces black
>>> images. I wrote the Texture to png right after the rendering in
>>> order to avoid errors with the shaders or whatever.
>>
>> Please note that for the FBO case it is possible that the textures
>> live *only* in GPU memory. You need to instruct the FBOViewport do
>> download
>> them to CPU memory explicitly (setReadBuffer(true)).
> 
> OK, I didn`t take this into account. Now the program renders the two 
> textures and writes them alternately to the screen. I added the slightly 
> modified version, maybe it can help someone else in the future.
> However, there is still another open problem besides the warnings: Both 
> cameradecorators render the same image, so there is still no stereo 
> effect and I don`t know why. Maybe someone knows a solution?

ah, I think I found what causes that.  Add these to your FBOViewports:

vpright->setIgnoreCameraDecorators(false);

With these changes I see an interlaced torus drawn. It may need some 
tuning so that you don't see the non-interlaced torus when the SSM draws 
the scene.

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to