[osg-users] Synchronizing with textures uploads.

Robert Osfield robert.osfield at gmail.com
Thu Mar 8 04:48:32 PST 2018


Hi Altin,



On 8 March 2018 at 12:18, Altin Gjata <altingjataj at gmail.com> wrote:
> I use (the default) DrawThreadPerContext for the moment.

The first thing you need to try is SingleTheaded:

  viewer.setThreadingModel(osgViewer::Viewer::SingleTheaded);

I can't stress this enough, this is the biggest variable to test.  I
didn't suggest you do this in my previous email for no reason.

> Steeping through the code, It seems that uploading the image is done by applyTexImage_subload() called from within TextureRectangle::apply(state) called from a GraphicsThread. And this operation is triggered by renderingTraversals(). It just doesn't upload in time and the background rectangle drawn by this renderingTraversal() uses the previous image.
>
> Is there any way I can trigger applyTexImage_subload() sooner?

The subload will be happening as sooner as is necessary to properly
reflect the updates to the osg::ImageStream, it's a pretty widely
fleshed out part of the OSG, this won't be the problem, the problem
will be elsewhere.  If the subload is not happening soon enough for
you then it's because the updated dirty of the image stream isn't
happening soon enough.

> Would it help if I used another camera that also uses the same ImageStream as texture and renders to a small texture, and set its rendering order before that of the camera that renders the background?

No. Coming up with ever more complicated solutions to a problem you
don't yet understand is only going to take you further away from the
solution.

The key to a solution is understanding the problem.  Without actual
code to look or even better test there really isn't too much we can do
apart from give you general pointers.

Robert.


More information about the osg-users mailing list