<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Dear community,<br>
<br>
today I need your help. Since many days I try finding a solution for
my problem - unfortunately without success.<br>
<br>
Here are the facts:<br>
<br>
I have a view for my scene and a camera manipulator.<br>
The scene has a switch node holding the actual scene and some
classes for creation of shadow, ambient shadow etc.<br>
Everything works pretty well so far.<br>
<br>
For some reasons we decided rendering the actual scene into a
texture and displaying this texture in a hud.<br>
So we create a texture and a rtt camera and added it to the above
switch.<br>
Then we removed the actual scene from the switch and added it as a
child to the rtt camera.<br>
<br>
In order to get the scene moved according to the camera manipulator
we installed a cull callback updating the rtt cameras matrices:<br>
<br>
<pre><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">renderCamera</span>.<span style=" color:#00677c;">valid</span>())<span style=" color:#c0c0c0;"> </span>{
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">osg</span>::<span style=" color:#800080;">Camera</span><span style=" color:#c0c0c0;"> </span>*<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">cam</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#00677c;">getMainCamera</span>();</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">renderCamera</span>-><span style=" color:#00677c;">setViewMatrix</span>(<span style=" color:#092e64;">cam</span>-><span style=" color:#00677c;">getViewMatrix</span>());</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">renderCamera</span>-><span style=" color:#00677c;">setProjectionMatrix</span>(<span style=" color:#092e64;">cam</span>-><span style=" color:#00677c;">getProjectionMatrix</span>());</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">renderCamera</span>-><span style=" color:#00677c;">setClearColor</span>(<span style=" color:#092e64;">cam</span>-><span style=" color:#00677c;">getClearColor</span>());</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
Without this callback all matrices are odd and zNear and zFar are
both at 0.0f.<br>
Question 1: Why is it like that? The rtt camera is a child of the
main camera and should not need above settings. (?)<br>
Question 2: In the original configuration zNear and zFar of the main
camera gets recalculated continuously.<br>
In the rtt configuration zNear is always
0.0f and zFar always 10000f. Why? The rtt camera is child of main
camera and it has the actual scene as a child.<br>
So all cullings should take the actual scene
in account.<br>
I'm really lost. When looking at the osgdeferred example I see the
rtt camera is just created, gets a viewport and gets a child of the
main camera. So easy!<br>
What am I doing wrong and/or where can I start for a deeper
research?<br>
<br>
Many thanks for any help.<br>
<br>
- Werner -<br>
<br>
<br>
<br>
</body>
</html>