[osg-users] Synchronizing with textures uploads.

Altin Gjata altingjataj at gmail.com
Wed Mar 7 13:03:17 PST 2018


Hi,

I'm trying to build an augmented reality application using OSG. My main problem, with which I've been struggling for weeks, hacking little temporal victories only to find myself in the ground again, is keeping in sync the camera position with the video frame uploaded to a background texture.

When a new video frame is processed, I call


Code:
osg::ImageStream::setImage(img.cols, img.rows, 1, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE,	img.data, osg::Image::NO_DELETE, 1);




and post in a queue the camera matrix to be read the next rendering cycle by the thread in which OSG runs. The camera position is updated, but the video frame may not make it in time to upload to GPU for this rendering frame, and the old image corresponding to the previous video frame appears instead.

>From what I've noticed, the call to ImageStream::setImage() merely marks the texture as dirty, but doesn't initiate an upload to GPU. So I have the new video frame ready, the GPU is free, and I don't know how to convince it to start uploading. By the time renderingTraversals() is called, the GPU can't load it in time.

This is my first time using OSG and I don't know its tricks. I would appreciate very much any help from the community. 

Thank you!

Cheers,
Altin[/code]

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







More information about the osg-users mailing list