title: OpenSceneGraph Texture2D image "dirty" vs "setImage" performance
body: <p>I have a 2D texture placed over rectangular area - it's a dynamic texture image (640x480).</p>
  
  <pre><code>tex = new osg::Texture2D;
  tex-&gt;setDataVariance( osg::Object::DYNAMIC );
  tex-&gt;setResizeNonPowerOfTwoHint( false );
  tex-&gt;setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST );
  tex-&gt;setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST );
  tex-&gt;setImage(myImage);
  </code></pre>
  
  <p>My image data is updated in other thread often (each N milliseconds):</p>
  
  <pre><code>myImage-&gt;setImage(
      width,
      height,
      1,
      3,
      GL_BGR,
      gl_data_size,
      (BYTE *)newImageData,
      osg::Image::AllocationMode::USE_MALLOC_FREE
  );
  </code></pre>
  
  <p>And after that I want to update rendered image, if I use dirty( thought this was a best way for update ) on image set to texture, e.g.</p>
  
  <pre><code>// Update callback
  ...
  myImage-&gt;dirty();
  ...
  </code></pre>
  
  <p>My performance is about 7-8 times slower than if I use just image replacement with same pointer.</p>
  
  <pre><code>// Update callback
  ...
  tex-&gt;setImage(myImage);
  ...
  </code></pre>
  
  <p>Reading documentation and gidelines of OSG makes me think the correct way is - 'dirty()'. But it's extremly slow. Do I missunderstand something or there is a mistake in my code?</p>