OK, I was misunderstanding how the setColorMode method worked. I changed that 
to setColorMode( osg::Material::OFF ), but the first geometry is still using 
the color from the color array (green), and the second geometry is using that 
same color.

Here's my updated scenegraph in case it helps:

Code:
Camera {
  UniqueID Camera_0
  nodeMask 0xffffffff
  cullingActive FALSE
  StateSet {
    rendering_hint DEFAULT_BIN
    renderBinMode INHERIT
    Viewport {
      UniqueID Viewport_1
      x 0
      y 0
      width 2046
      height 2048
    }
    textureUnit 0 {
    }
    textureUnit 1 {
    }
    textureUnit 2 {
    }
    textureUnit 3 {
      GL_TEXTURE_GEN_S OVERRIDE|OFF
      GL_TEXTURE_GEN_T OVERRIDE|OFF
      GL_TEXTURE_GEN_R OVERRIDE|OFF
      GL_TEXTURE_GEN_Q OVERRIDE|OFF
      TexGen {
        mode OBJECT_LINEAR
        plane_s 1 0 0 0
        plane_t 0 1 0 0
        plane_r 0 0 1 0
        plane_q 0 0 0 1
      }
    }
  }
  referenceFrame ABSOLUTE
  clearColor 0 0.4 0 1
  clearMask 0x100
  Use Viewport_1
  transformOrder PRE_MULTIPLY
  ProjectionMatrix {
    0.000977517 0 0 0
    0 0.000976563 0 0
    0 0 -0.002002 0
    -0 -0 -1.002 1
  }
  ViewMatrix {
    1 0 -0 0
    -0 1 -0 0
    0 0 1 0
    0 0 -500 1
  }
  renderOrder PRE_RENDER
  renderTargetImplementation FRAME_BUFFER_OBJECT
  renderTargetFallback PIXEL_BUFFER_RTT
  drawBuffer 0
  readBuffer 0
  bufferComponent COLOR_BUFFER {
    internalFormat 0
    Texture2D {
      UniqueID Texture2D_2
      DataVariance DYNAMIC
      wrap_s CLAMP
      wrap_t CLAMP
      wrap_r CLAMP
      min_filter LINEAR
      mag_filter LINEAR
      maxAnisotropy 1
      borderColor 0 0 0 0
      borderWidth 0
      useHardwareMipMapGeneration TRUE
      unRefImageDataAfterApply FALSE
      internalFormatMode USE_USER_DEFINED_FORMAT
      internalFormat GL_RGBA
      resizeNonPowerOfTwo TRUE
    }
    level 0
    face 0
    mipMapGeneration FALSE
  }
  num_children 2
  MatrixTransform {
    UniqueID MatrixTransform_3
    nodeMask 0xffffffff
    cullingActive TRUE
    referenceFrame RELATIVE
    Matrix {
      20.46 0 0 0
      0 20.48 0 0
      0 0 1 0
      0 0 0 1
    }
    num_children 1
    Geode {
      UniqueID Geode_4
      DataVariance DYNAMIC
      nodeMask 0xffffffff
      cullingActive TRUE
      num_drawables 1
      Geometry {
        UniqueID Geometry_5
        DataVariance DYNAMIC
        StateSet {
          rendering_hint DEFAULT_BIN
          renderBinMode INHERIT
          Material {
            ColorMode OFF
            ambientColor 1 1 0 1
            diffuseColor 1 1 0 1
            specularColor 0 0 0 1
            emissionColor 0 0 0 1
            shininess 0
          }
        }
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 1
        {
          DrawArrays QUADS 0 4
        }
        VertexArray UniqueID Vec3Array_6 Vec3Array 4
        {
          0.5 0.5 0
          -0.5 0.5 0
          -0.5 -0.5 0
          0.5 -0.5 0
        }
        NormalBinding OVERALL
        NormalArray UniqueID Vec3Array_7 Vec3Array 1
        {
          0 0 1
        }
        ColorBinding OVERALL
        ColorArray UniqueID Vec4Array_8 Vec4Array 1
        {
          0 1 0 1
        }
      }
    }
  }
  MatrixTransform {
    nodeMask 0xffffffff
    cullingActive TRUE
    referenceFrame RELATIVE
    Matrix {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 0 1
    }
    num_children 1
    Geode {
      UniqueID Geode_9
      DataVariance DYNAMIC
      nodeMask 0xffffffff
      cullingActive TRUE
      num_drawables 1
      Geometry {
        UniqueID Geometry_10
        DataVariance DYNAMIC
        StateSet {
          rendering_hint DEFAULT_BIN
          renderBinMode INHERIT
          Material {
            ColorMode OFF
            ambientColor 1 0 1 1
            diffuseColor 1 0 1 1
            specularColor 0 0 0 1
            emissionColor 0 0 0 1
            shininess 0
          }
        }
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 1
        {
          DrawArrays TRIANGLE_FAN 0 18
        }
        VertexArray UniqueID Vec3Array_11 Vec3Array 18
        {
          0 0 0
          1 0 0
          0.92388 0.382683 0
          0.707107 0.707107 0
          0.382683 0.92388 0
          6.12323e-017 1 0
          -0.382683 0.92388 0
          -0.707107 0.707107 0
          -0.92388 0.382683 0
          -1 1.22465e-016 0
          -0.92388 -0.382683 0
          -0.707107 -0.707107 0
          -0.382683 -0.92388 0
          -1.83697e-016 -1 0
          0.382683 -0.92388 0
          0.707107 -0.707107 0
          0.92388 -0.382683 0
          1 0 0
        }
        NormalBinding OVERALL
        NormalArray UniqueID Vec3Array_12 Vec3Array 1
        {
          0 0 1
        }
        ColorBinding OVERALL
        ColorArray UniqueID Vec4Array_13 Vec4Array 1
        {
          1 0 0 1
        }
      }
    }
  }
}




Thanks,
Dan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43327#43327





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

Reply via email to