[osg-users] Memory leak when using a pixel buffer to generate thumbnails

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Wed Jun 24 00:14:42 PDT 2020


Thanks Robert, excellent answer.

I think I have enough for a way forward now.
One small remaining question,

Does readRefNodeFile access GL at all for any of these file 
formats:".3ds",".dae",".shp",".dxf"?
Or, to put it another way, can readRefNodeFile be called safely from a 
std:async thread to return something containing a usable osg::Node within 
the main application?

Thanks,

Brian

On Tuesday, 23 June 2020 18:10:21 UTC+1, Robert Osfield wrote:
>
> I can;t say what the leak will be from the code supply but I can say that 
> creating a dedicated viewer, rendering a frame, then destroying really 
> isn't an efficient way to go about generating a thumbnail image.  Rather 
> than than debug a dubious approach I'd suggest you leave it and try another 
> lighter weight approach.
>
> The best approach is something I can't say at this point as I don't know 
> enough about your application and your needs for generating a thumbnail.  
> Is it a one off activity, something you do offline, something that is done 
> occasionally?  How to go about things depends upon your usage case.
>
> As a general comment, creating an destroying objects on OpenGL and 
> consequently the OSG is expensive.  It's far better to create once and 
> reuse, even if you don't reuse often.
>
> Also creating separate graphics context is very expensive, if you already 
> have a graphics context then the best thing to do for offscreen rendering 
> is to your a frame buffer object and render to texture.  This way you can 
> minimize the amount of new GL objects being created for the task,  W.r.t 
> running in a background thread, OpenGL isn't a multi-threaded API, you can 
> only multi-thread with multiple graphics context with t a thread per 
> context.  It's only really suitable for mulitple GPU tasks.  It's typically 
> far better to just add the work to the standard frame and run it as part of 
> your normal viewer.
>
> With the OSG you can toggle on/off render to texture by setting the 
> NodeMask of an osg::Camera.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/e44f9dff-198c-48a5-b785-795bd373cc12o%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200624/5f4f66d6/attachment.html>


More information about the osg-users mailing list