Hi Mike,

On 14 February 2015 at 20:10, Mike Raider <[email protected]> wrote:

> There is an osg example, osgsimulation, that shows a plane flying above
> the earth.  I am building a simple flight simulator and would like to put a
> cockpit frame around the view so it would look like the plane in
> osgsimulation is being followed by a 2nd plane.  What is the best way to
> frame a view with a graphic so it does not obstruct the movement of the
> earth or the plane?
>
> Is there an example of such a frame?  Can a single graphic be used as the
> cockpit with a transparent center for the leading plane and terrain?
>

The way I'd implement a cockpit view would be to create a separate 3d model
of it and render it as separate osg::Camea is rendered after the terrain is
render that clears the depth buffer and then overwrites the terrain.  This
Camera would have it's RenderenceFrame set to ABSOLUTE_TF so the the main
viewer's Camera's view matrix gets ignored and only the local osg::Camera's
view and projection matrices get used.   The osghud example illustrates how
this is done for a text overlays, but it works just as well with 3D content.

The approach of using separate osg::Camera allows one to keep the depth
ranges of the terrain vs cockpit separate so that z buffer precision issues
don't cause problems.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to