[vtk-developers] Crash with OpenGL2 Renderer only in vtkOpenGLBufferObject destructor.

Ken Martin ken.martin at kitware.com
Thu Aug 11 11:44:28 EDT 2016


Yes you definitely want to call ReleaseGraphicsResources when you are done
using a graphics object, but are not done using its window. Normally VTK
handles this for you so you do not have to worry about it.

Many classes in VTK create and hold onto OpenGL resources. At some point
those resources need to be freed. Normally before an OpenGL context/window
is destroyed it will call ReleaseGraphicsResources on everything connected
to it so that they are all freed before it releases the context. But if you
have detached a mapper from the RenderWindow/Renderer/Actor (but not yet
deleted it) then that does not happen. Then at some other point that mapper
tries to free its resources but the context that owned them is already gone
causing an error.

Thanks
Ken



On Thu, Aug 11, 2016 at 11:33 AM, Seun Odutola <seun at rogue-research.com>
wrote:

> Hi Ken,
>
>     Thanks for the suggestion. I do have a little question though, is it a
> necessary convention to call release graphics resources on the old mapper
> prior to setting a new one? I was wondering judging from your statement
> (quick fix) if this was just a hack.
>
> Regards,
>     Seun
>
> On Aug 8, 2016, at 1:00 PM, Ken Martin <ken.martin at kitware.com> wrote:
>
> How do you change the mapper? Do you immediately destroy the old mapper or
> leave it around for  later? I suspect the old mapper is getting destroyed
> later than it should. One thing you can try as a quick fix is
>
> actor->SetMapper(shiny new mapper);
> oldMapper->ReleaseGraphicsResources(renWin or NULL if you don;t have the
> window handy)
> ...
>
>
>
> On Thu, Aug 4, 2016 at 3:21 PM, Seun Odutola <seun at rogue-research.com>
> wrote:
>
>> Hello everyone,
>>
>>       I have a crash that occurs in my application when running vtk with
>> the GL2 rendered enabled but not with GL1. So here is the situation, in my
>> program when I change the shape of my poly data mapper, basically setting
>> the mapper of an actor in my scene to a new poly data mapper it results in
>> a crash.  The crash is  situated in vtkOpenGLBufferObject’s destructor,
>> specifically the deletion of the Internal’s handle. I have tried to verify
>> if the handle is valid prior to reaching the destructor which it seems to
>> be, my main concern is if the handle is filled with garbage (a non-zero
>> value) it might effectively pass the test condition and try to invoke
>> glDeleteBuffer. Has anyone experienced anything similar to this?
>> Regards,
>>    Seun
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
>>
>
>
> --
> Ken Martin PhD
> Chairman & CFO
> Kitware Inc.
> 28 Corporate Drive
> Clifton Park NY 12065
> 518 371 3971
>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee.  Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message.  Thank you.
>
>
>


-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160811/c484e09b/attachment-0001.html>


More information about the vtk-developers mailing list