[osg-users] Synchronizing with textures uploads.

Voerman, L. l.voerman at rug.nl
Thu Mar 8 05:08:16 PST 2018


Hi Altin,
just a few remarks:

you wrote:
 >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.
That's not how it works, openGL will upload the image before using it to
render. This might be slow for a big image, but the old image will not be
used. You might be tricked by a tripple buffering driver, where at the next
buffer swap you will see a render containing the old image.

2> test singlethreaded. I've seen no hint that you marked the stateset
containing the imageStream texture as DYNAMIC,  so the renderingTraversal
might return before the texture or uniform has been apply'ed - trusting the
(default) STATIC promise.

Regards, Laurens.

On Thu, Mar 8, 2018 at 1:48 PM, Robert Osfield <robert.osfield at gmail.com>
wrote:

> 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.
> _______________________________________________
> 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/20180308/be8dd024/attachment.html>


More information about the osg-users mailing list