[osg-users] painting plane

Korolyov Ilia ya-breeze at ya.ru
Thu Sep 11 10:11:45 PDT 2008


Hi, Robert

I'll try first one.

Thanks
Ilia


В Чтв, 11/09/2008 в 16:40 +0100, Robert Osfield пишет:
> Hi Ilia,
> 
> The way I'd do it be to use a cull callback that decides between two
> subgraphs to traverse, one for the front face, one for the back, this
> would mean that your scene graph doesn't change with the viewport, and
> it'll scale nicely on multi-threaded and multi-camera setups.
> 
> The other approach would be to use a vertex shader to change the
> light, or to use two sided lighting, which if you orientate the
> normals on the light correctly will work for you.
> 
> Robert.
> 
> On Thu, Sep 11, 2008 at 4:35 PM, Korolyov Ilia <ya-breeze at ya.ru> wrote:
> > Ok. Coming back to first letter - what is right way to do such painting?
> >
> > As I understand, proper way to change scene - is using UpdateCallback.
> > But in UpdateCallback there is no camera information. So I can't define
> > suitable color for lines. In CullCallback there is camera information,
> > but it's forbidden to change scene in CullCallback.
> >
> > It's possible to save reference to camera object in UpdateCallback
> > descendant. Is it correct way?
> >
> > Thanks
> > Ilia
> >
> >
> > В Чтв, 11/09/2008 в 09:28 -0400, Tomlinson, Gordon пишет:
> >> Doubtful really as lines don't have back faces..
> >>
> >> Gordon
> >>
> >> __________________________________________________________
> >> Gordon Tomlinson
> >> Email  : gtomlinson @ overwatch.textron.com
> >>
> >>
> >> -----Original Message-----
> >> From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Korolyov Ilia
> >> Sent: Thursday, September 11, 2008 9:20 AM
> >> To: OpenSceneGraph Users
> >> Subject: Re: [osg-users] painting plane
> >>
> >> Hello
> >>
> >> This technic working fine for poligons, but is it possible to make this trick to lines? I need exactly two lines, not three as in triangle.
> >>
> >> I trying in such way
> >>
> >> group->addChild( geode_with_poligons );
> >> group->addChild( geode_with_lines );
> >> group->getOrCreateStateSet()->setMode( GL_CULL_FACE, GL_BACK |
> >> osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );
> >>
> >> Thanks
> >> Ilia
> >>
> >> В Чтв, 11/09/2008 в 14:46 +0400, Korolyov Ilia пишет:
> >> > Hello, Robert
> >> >
> >> > Thanks so much - it really helps
> >> >
> >> > Ilia
> >> >
> >> > В Чтв, 11/09/2008 в 11:38 +0100, Robert Osfield пишет:
> >> > > Hi Ilia,
> >> > >
> >> > > If one side of the plane should be red, and the other blue then you
> >> > > could render two polygons for the plane, each with opposite winding
> >> > > and colour, then use glCullFace(osg::CullFace) to cull the faces to
> >> > > give the illusion of changing colour.  The other technique you could
> >> > > use of two sided colour in the OpenGL lighting/material model, not
> >> > > all hardware/drivers supports two side lighting though.
> >> > >
> >> > > Robert.
> >> > >
> >> > > On Thu, Sep 11, 2008 at 11:22 AM, Korolyov Ilia <ya-breeze at ya.ru> wrote:
> >> > > > Hello
> >> > > >
> >> > > > I need to draw a plane (more exactly two lines by three points).
> >> > > > Problem is in plane color. It must depends on camera position
> >> > > > relative plane side - red or blue.
> >> > > >
> >> > > > I did it with CullCallback, because it's only one way to get
> >> > > > access to camera, which I can find.
> >> > > >
> >> > > > What is right way to do it?
> >> > > >
> >> > > > Thanks
> >> > > > Ilia
> >> > > >
> >> > > > _______________________________________________
> >> > > > osg-users mailing list
> >> > > > osg-users at lists.openscenegraph.org
> >> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegr
> >> > > > aph.org
> >> > > >
> >> > > _______________________________________________
> >> > > osg-users mailing list
> >> > > osg-users at lists.openscenegraph.org
> >> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegrap
> >> > > h.org
> >> >
> >> > _______________________________________________
> >> > osg-users mailing list
> >> > osg-users at lists.openscenegraph.org
> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> >> > org
> >>
> >> _______________________________________________
> >> osg-users mailing list
> >> osg-users at lists.openscenegraph.org
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> _______________________________________________
> >> osg-users mailing list
> >> osg-users at lists.openscenegraph.org
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list