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

Sean McBride sean at rogue-research.com
Thu Aug 25 16:17:14 EDT 2016


Hi Ken,

We are still trying to fully understand our bug, but wondered if you (or anyone :)) could clarify a couple of things, all in the form of true/false :)

- actors are tied to a particular render window
  - thus they can't be added to two render windows, or moved between two, etc.
- mappers are likewise tied to a particular render window
- it is permitted to change an actor's mapper
- a single mapper can be shared by multiple actors

Is that all correct?

Thanks,

Sean


On Thu, 11 Aug 2016 14:31:31 -0400, Seun Odutola said:

>Hi Ken,
>   
>I have a scenario where I have an actor and a mapper connected to it (so
>in the application window it renders i.e: a sphere). The user has the
>ability to change the shape (to cube for example) via the UI, so
>internally this is what I’m doing: I have an actor that I keep around,
>when the user changes the shape, I just create a new mapper and set the
>actor’s mapper directly to the new one (not calling the
>ReleaseGraphicsResources).
>
>First, is this reasonable? Or every time I need to create a new mapper
>is it best to also create a new actor to connect it to? or does it
>suffice to just swap the actor’s mapper by calling SetMapper()? In the
>latter case, then one needs to call ReleaseGraphicsResources on the
>previous mapper prior to setting up a new one, right?
>
>Relatedly, I would like to know for the sake of clarity if mappers can
>be shared between actors; that is, is the relationship of an actor and
>its mapper a 1 to 1 relationship?
>
>Regards,
>   Seun
>
>> On Aug 11, 2016, at 11:52 AM, Seun Odutola <seun at rogue-research.com> wrote:
>> 
>> Thanks for the expeditious and detailed response Ken, I truly
>appreciate it. Perfect, this is exactly what I thought but needed the
>opinion of someone more experienced. I had a closer look at vtkActor and
>noticed how it checks the validity of it’s Mapper prior to releasing it
>(in its release graphics resource function) proof that it indeed needs
>to be released via calling ReleaseGraphicsResources sometime down the
>line. Thanks
>> 
>> Regards,
>>    Seun.
>>  
>>> On Aug 11, 2016, at 11:44 AM, Ken Martin <ken.martin at kitware.com
><mailto:ken.martin at kitware.com>> wrote:
>>> 
>>> 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 <mailto: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
><mailto: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 <mailto: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



More information about the vtk-developers mailing list