Hi Robert,

I already had a look at this, but it's not an option in my case : I
really need a way to have 2 distinct calls, one for all pre_render
cameras, one for others, each call may be callbacks from the main app.
(by the way, I think this would be very helpful for all who use 2
homogeneous 3d engines at a time (OSG aside a custom one))

If I understood correctly ShadowMap and osg stuff, I can generate the
osg shadow map texture (the 'first call') like that
(in ShadowMap)
                (*(_camera->getRenderer()))(_camera->getGraphicsContext());

but how may I avoid the camera to re-render when I'll call the
Viewer::renderingTraversals ('second call') ?

Fred


On Tue, Oct 20, 2009 at 9:45 AM, Robert Osfield
<[email protected]> wrote:
> Hi Fred,
>
> By far the easiest way to do what you want is to use a post draw
> callback on the RTT Camera, or a pre draw callback on the master
> callback, and have this draw callback do your custom OpenGL code
> calls.
>
> Robert.
>
> On Mon, Oct 19, 2009 at 9:19 PM, Frederic Marmond <[email protected]> wrote:
>> Thanks Robert,
>>
>> Rendering to texture is ok, it works fine.
>> What I need is to completely split the rendering (pre and others) in 2
>> very own calls (or find a way to do the same)
>> To explain the context / my need, here is a little documented 'code' :
>>
>>
>> myOwn3DEngine* aCustom3DEngine;
>> osgViewer* myViewer;
>>
>> //init the osg world, add a osg shadowedScene (with
>> osgShadow::ShadowMap technique)
>> [...]
>>
>> //init my own world (aside osg one)
>> [...]
>>
>>
>> //in the application loop:
>>
>> // do all osg render to textures (including shadow map generating)
>> myViewer->prerenderingTraversals(); // <---- I miss this one :)
>>
>> // play with generated textures (like adding shadow of non osg objects
>> in shadow maps)
>> myOwn3DEngine->updateOsgShadowMaps();
>>
>> // draw my custom 3d engine, with shared shadow map (shadow maps will
>> include osg shadows)
>> myOwn3DEngine->render();
>>
>> //draw the OSG scene with updated textures (excluding prerendering
>> stages, as they are done few lines above)
>> myViewer->renderingTraversals();
>>
>>
>> => is there any method to do something like that ?
>> if I call twice the current renderingTraversals(), textures (including
>> shadow maps) will be overwritten at each ?
>> node switch in the graph to enable/disable the rtt camera ? (seems ugly to 
>> me)
>>
>>
>>
>> Fred
>>
>>
>>
>>
>> On Mon, Oct 19, 2009 at 9:43 PM, Robert Osfield
>> <[email protected]> wrote:
>>> Hi Frederic,
>>>
>>> Are you familiar with the osgViewer/osg::Camera RTT capabilities?
>>> They are very flexible now, you can render subgraphs under an scene
>>> graph RTT osg::Camera as a pre rendering stage then switch it off for
>>> subsequent frames.   Have a look at the osgprerender,
>>> osgprerendercubemap examples as well as osgShadow itself.
>>>
>>> Robert.
>>>
>>> On Mon, Oct 19, 2009 at 7:52 PM, Frederic Marmond <[email protected]> 
>>> wrote:
>>>> Hi all,
>>>>
>>>> I would like to generate a shadow map before the real scene draw, in
>>>> order to alter it (add 3rd parties objects shadows in it) before
>>>> applying the shadow map to the 'real' world.
>>>> The context is that osg is called inside a custom 3D engine, so a post
>>>> prerender callback won't be enough.
>>>>
>>>> How should I achieve that ?
>>>> is there a way to do only pre-render stages, then others ?
>>>>
>>>> thanks in advance
>>>>
>>>> Fred
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> [email protected]
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to