[osg-users] Loading problem, OpenVR integration

Robert Osfield robert.osfield at gmail.com
Thu Nov 3 02:36:56 PDT 2016

Hi Lorenzo,

>From your description it's sounds like either objects aren't
pre-compiled or that they have been pre-compiled but not yet
downloaded by the GPU.

In OpenGL there is no way to formally force a GL object to be download
to the GPU, it's up to the drive to decide what it does when.  You can
however leverage the fact that texture and vertex buffer objects will
be made resident on the GPU by rendering them and as long as there is
enough memory to keep them around they'll be left resident by the
driver for when you actually need them.

The osgUtil::GLObjectsVisitor just does compilation it doesn't do any
dummy rendering to force the download to the GPU.  The
osgUtil::IncrementalCompileOperation does has an option for rendering
an dummy geometry to force the download of textures, but this is not
on by default, and only used during incremental compilation - i.e.
when using a paged database.

One possible route you could take would be to subclass from
GLObjectVisitor and add in a geometry in a similar way to what the
IncrementalCompileOpeation does and invoke this via a custom
RealizeOperation (see the osgvolume example to see how
RealizeOperation can be used.) You'd need to make sure that your scene
graph is assigned to the viewer before the windows are realized

When rendering a force download dymmy geometry you'd want to do it in
a way the geometry rendering doesn't affect the framebuffer, either by
doing prior to a clear of the graphics window or by ensuring all
geometry is out of the view frustum or discarding the fragments.


More information about the osg-users mailing list