Hi Shawl,

Could you explain for what purpose you need to temporarily modify the
projection matrix, this has a huge baring on how you will want to go
about it.

The OSG has an osg::Projection node that allows you to override the
project matrix for the subgraph that you attach below the Projection
Node, and the osg::Camera node that allows you to modify the
projection and view matrices, and there there is slave Camera's at the
viewer level, and finally cull callbacks that you can use to modify
the modelview and projection matrices along with many other things.
As you see there are plenty of options, which to recommend I can't say
as you haven't yet given the context of the problem you are trying to
solve.

Robert.

On 29 October 2012 00:21, wh_xiexing <wh_xiex...@sina.com> wrote:
> i want to implement the same effect of the following code using open scene
> graph. can it be possiable?
>
> public void pushProjectionOffest(Double offset)
>     {
>         // Modify the projection transform to shift the depth values
> slightly toward the camera in order to
>         // ensure the lines are selected during depth buffering.
>         GL gl = this.getGL();
>
>         float[] pm = new float[16];
>         gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0);
>         pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed.
> Section 9.1.2 to compute optimal offset
>
>         gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
>         gl.glMatrixMode(GL.GL_PROJECTION);
>         gl.glPushMatrix();
>         gl.glLoadMatrixf(pm, 0);
>     }
>
>  public void popProjectionOffest()
>     {
>         GL gl = this.getGL();
>
>         gl.glMatrixMode(GL.GL_PROJECTION);
>         gl.glPopMatrix();
>         gl.glPopAttrib();
>     }
>
> ________________________________
> Shawl
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to