[osg-users] State problem

Robert Osfield robert.osfield at gmail.com
Tue Oct 30 11:35:23 PDT 2007


HI Loinel,

Where you have Matrial::ColorMode set to anything other than OFF you need to
specify an ColorArray on the associted Drawable - this is missing, so the
drawable is inheriting a random value for its colour.

Robert

On 10/30/07, Lionel Lagarde <lionel.lagarde at oktal.fr> wrote:
>
>  Hi,
>
> I'm running osgviewer (2.0 and 2.2) with the attached OSG file.
>
> The file is composed of 4 drawables. Each drawable defines its own
> StateSet.
> The last drawable material is:
>
> Material {
>   DataVariance UNSPECIFIED
>   ColorMode OFF
>   ambientColor 1 1 1 1
>   diffuseColor 1 0 0 1
>   specularColor 0 0 1 1
>   emissionColor 0 1 0 1
>   shininess 10
> }
>
> But the emissive part is not taken into account.
> Curiously, the first frame is correct. The corresponding quad is yellow.
> In the other frames, the quad is red.
>
> If I remove one or more drawable, or if I change the order of the
> drawables
> in the file, the quad is correctly rendered.
>
>
> The bad image:
>
>
> What it should be (I've removed the first drawable):
>
>
> Please help !!!
>
> Group {
>  DataVariance UNSPECIFIED
>  name "dummy:root"
>  nodeMask 0xffffffff
>  cullingActive TRUE
>  num_children 1
>  Geode {
>    DataVariance UNSPECIFIED
>    name "dummy:geode"
>    nodeMask 0x10000
>    cullingActive TRUE
>    num_drawables 4
>    Geometry {
>      DataVariance STATIC
>      name "dummy:geode:geom0"
>      StateSet {
>        DataVariance STATIC
>        rendering_hint DEFAULT_BIN
>        renderBinMode INHERIT
>                  GL_LIGHTING ON
>        Material {
>          DataVariance UNSPECIFIED
>          name "INH18L75.rgbvisible"
>          ColorMode AMBIENT_AND_DIFFUSE
>          ambientColor 1 1 1 1
>          diffuseColor 1 1 1 1
>          specularColor 0 0 0 1
>          emissionColor 0 0 0 1
>          shininess 0
>        }
>      }
>      useDisplayList TRUE
>      useVertexBufferObjects FALSE
>      PrimitiveSets 1
>      {
>        DrawElementsUByte QUADS 4
>        {
>          0 1 2 3
>        }
>      }
>      VertexArray Vec3Array 4
>      {
>        -30 -30 0
>                  0 -30 0
>                  0 0 0
>                  -30 0 0
>      }
>      NormalBinding PER_VERTEX
>      NormalArray Vec3Array 4
>      {
>        0 0 1
>        0 0 1
>        0 0 1
>        0 0 1
>      }
>    }
>    Geometry {
>      DataVariance STATIC
>      name "dummy:geode:geom1"
>      StateSet {
>        DataVariance STATIC
>        rendering_hint DEFAULT_BIN
>        renderBinMode INHERIT
>                  GL_LIGHTING ON
>        Material {
>          DataVariance UNSPECIFIED
>          name "RAIL1.rgbvisible"
>          ColorMode AMBIENT_AND_DIFFUSE
>          ambientColor 1 1 1 1
>          diffuseColor 1 1 1 1
>          specularColor 0 0 0 1
>          emissionColor 0 0 0 1
>          shininess 0
>        }
>      }
>      useDisplayList TRUE
>      useVertexBufferObjects FALSE
>      PrimitiveSets 1
>      {
>        DrawElementsUByte QUADS 4
>        {
>          0 1 2 3
>        }
>      }
>      VertexArray Vec3Array 4
>      {
>                  0 -30 0
>                  30 -30 0
>                  30 0 0
>                  0 0 0
>      }
>      NormalBinding PER_VERTEX
>      NormalArray Vec3Array 4
>      {
>        0 0 1
>        0 0 1
>        0 0 1
>        0 0 1
>      }
>    }
>    Geometry {
>      DataVariance STATIC
>      name "IMM:geode0::geom"
>      StateSet {
>        DataVariance STATIC
>        rendering_hint DEFAULT_BIN
>        renderBinMode INHERIT
>        GL_LIGHTING ON
>        Material {
>          DataVariance UNSPECIFIED
>          ColorMode OFF
>          ambientColor 1 1 1 1
>          diffuseColor 1 1 1 1
>          specularColor 0 0 0 1
>          emissionColor 0 0 0 1
>          shininess 0
>        }
>      }
>      useDisplayList TRUE
>      useVertexBufferObjects FALSE
>      PrimitiveSets 1
>      {
>        DrawArrays QUADS 0 4
>      }
>      VertexArray Vec3Array 4
>      {
>        -13.5 0 26
>        -6 0 26
>        -6 0 27
>        -13.5 0 27
>      }
>      NormalBinding PER_VERTEX
>      NormalArray Vec3Array 4
>      {
>        0 -1 0
>        0 -1 0
>        0 -1 0
>        0 -1 0
>      }
>    }
>    Geometry {
>      DataVariance STATIC
>          name "IMM:geode1:geom"
>      StateSet {
>        DataVariance STATIC
>        rendering_hint DEFAULT_BIN
>        renderBinMode INHERIT
>        GL_LIGHTING ON
>        Material {
>          DataVariance UNSPECIFIED
>          ColorMode OFF
>          ambientColor 1 1 1 1
>          diffuseColor 1 0 0 1
>          specularColor 0 0 1 1
>          emissionColor 0 1 0 1
>          shininess 10
>        }
>      }
>      useDisplayList TRUE
>      useVertexBufferObjects FALSE
>      PrimitiveSets 1
>      {
>        DrawArrays QUADS 0 4
>      }
>      VertexArray Vec3Array 4
>      {
>                  -15 -15 3
>                  15 -15 3
>                  15 15 3
>                  -15 15 3
>      }
>      NormalBinding PER_VERTEX
>      NormalArray Vec3Array 4
>      {
>        0 0 1
>        0 0 1
>        0 0 1
>        0 0 1
>      }
>    }
>  }
> }
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071030/0a06c12d/attachment-0003.htm>


More information about the osg-users mailing list