Hi Paul,

Eye linear glTexGen is positional state, i.e. it's value depends on
the current modelview matrix, so has to be treated by the OSG like
other positional state like glLight and glClipPlane. All positional
state has to be positioned by a positional state node, and for
glTexGen this is TexGenNode.

During the cull traversal the OSG collects the positional state and
binds the TexGen/Light/ClipPlane to modelview matrix at that point in
traversal, this binding is done via the PositionalStateContainer, and
there is one of these per RenderStage.  During the draw traversal the
positional state is then applied prior to the traversal of the
RenderStage, and fixes each positional state in the appropriate place.
  While this technique doesn't properly fix the state as required, it
does limit you to one position, per stage, you can't have two eye line
tex gens/lights/clip planes applied on two separate subgraphs.

Object linear TexGen isn't positional state so can be applied in the
normal way and you have multiple of these per stage without problem.

To have multiple Eye linear TexGen/TexGenNode's you'll need to break
the scene up into multiple RenderStage and use the clear mask set to 0
on the subsequent stages so that each stage overlays correctly on the
previous one.  Other approaches are to write a custom TexGen that you
push/pop a custom modelview matrix.  I'm afraid both approaches are
rather hacky.

Robert.

On Thu, Jan 13, 2011 at 2:28 AM, Paul Martz <[email protected]> wrote:
> Hi all -- Has anyone ever successfully used multiple TexGen modes (say,
> EYE_LINEAR and OBJECT_LINEAR) on different objects in the same scene? What
> is the recommended way to do this in OSG?
>
> The TexGenNode has a pointer to a TexGen, and the TexGen has the mode. I
> assume I should create two TexGens, one OBJECT_LINEAR and one EYE_LINEAR,
> and two TexGenNodes to reference them, and add the two TexGenNodes to the
> scene graph. Then, I assume I should attach the same two TexGens as
> StateAttributes to different Node's StateSets as needed.
>
> I am running into some issues with this. If it sounds like I'm doing
> everything right, I'll post a small example that fails, or dig into the OSG
> code. More than likely, I'm doing something wrong here, so I just wanted to
> ask what the intended usage is.
>
> Thanks,
> --
>  -Paul Martz      Skew Matrix Software
>                   http://www.skew-matrix.com/
> _______________________________________________
> 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