Discussion:
[vtkusers] Moving Renderer to another Window
Matthew Troke
2018-11-23 16:00:00 UTC
Permalink
Once a vtkRenderer is attached to a vtkRenderWindow, can it be removed and
added to a another vtkRenderWindow temporarily to perform an operation in
isolation?

Here is what I tried:
- removed renderer from its current window with RemoveRenderer()
- created a new vtkRenderWindow with vtkNew and added renderer with
AddRenderer()
- I called a method on the renderer (which is my own derived class of
vtkOpenGLRenderer); inside this method, I create a new vtkTextureObject
using the context from the renderwindow and Create2DFromRaw(). This method
fails with an exception in vtkTextureObject::Bind() (Handle is null)

If I don't remove and add the renderer to another window, I don't get the
exception.
--
Matthew Troke
Software Engineer
Office: 1-709-701-0239
Email: ***@avalonholographics.com
--
_This email and any attachments are confidential and may be privileged. Any
unauthorized use, disclosure, copying or distribution of the information
received is prohibited. If you are not the intended recipient please
contact the sender immediately by return email confirming that you have and
will delete all communications related to the email and any attachments
sent to you in error._
Elvis Stansvik
2018-11-23 16:34:55 UTC
Permalink
I think a colleague did something like this for an "export image" feature
at work where we wanted to control the resolution of the exported inage.

I can have a look at how he worked around gotchas/crashes, but not until
Monday (on my way home).

I think the window and renderer have mutual references to each other and
need to be broken apart in the right order... Something like that..

Elvis

Den fre 23 nov. 2018 17:00Matthew Troke <
Post by Matthew Troke
Once a vtkRenderer is attached to a vtkRenderWindow, can it be removed and
added to a another vtkRenderWindow temporarily to perform an operation in
isolation?
- removed renderer from its current window with RemoveRenderer()
- created a new vtkRenderWindow with vtkNew and added renderer with
AddRenderer()
- I called a method on the renderer (which is my own derived class of
vtkOpenGLRenderer); inside this method, I create a new vtkTextureObject
using the context from the renderwindow and Create2DFromRaw(). This method
fails with an exception in vtkTextureObject::Bind() (Handle is null)
If I don't remove and add the renderer to another window, I don't get the
exception.
--
Matthew Troke
Software Engineer
Office: 1-709-701-0239
*This email and any attachments are confidential and may be privileged.
Any unauthorized use, disclosure, copying or distribution of the
information received is prohibited. If you are not the intended recipient
please contact the sender immediately by return email confirming that you
have and will delete all communications related to the email and any
attachments sent to you in error.*
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
https://public.kitware.com/mailman/listinfo/vtkusers
Sankhesh Jhaveri
2018-11-25 13:55:52 UTC
Permalink
Did you call Render on the new render window after adding the renderer and
before invoking the renderer method?
​

On Fri, Nov 23, 2018 at 11:35 AM Elvis Stansvik <
Post by Elvis Stansvik
I think a colleague did something like this for an "export image" feature
at work where we wanted to control the resolution of the exported inage.
I can have a look at how he worked around gotchas/crashes, but not until
Monday (on my way home).
I think the window and renderer have mutual references to each other and
need to be broken apart in the right order... Something like that..
Elvis
Den fre 23 nov. 2018 17:00Matthew Troke <
Post by Matthew Troke
Once a vtkRenderer is attached to a vtkRenderWindow, can it be removed
and added to a another vtkRenderWindow temporarily to perform an operation
in isolation?
- removed renderer from its current window with RemoveRenderer()
- created a new vtkRenderWindow with vtkNew and added renderer with
AddRenderer()
- I called a method on the renderer (which is my own derived class of
vtkOpenGLRenderer); inside this method, I create a new vtkTextureObject
using the context from the renderwindow and Create2DFromRaw(). This method
fails with an exception in vtkTextureObject::Bind() (Handle is null)
If I don't remove and add the renderer to another window, I don't get the
exception.
--
Matthew Troke
Software Engineer
Office: 1-709-701-0239 <(709)%20701-0239>
*This email and any attachments are confidential and may be privileged.
Any unauthorized use, disclosure, copying or distribution of the
information received is prohibited. If you are not the intended recipient
please contact the sender immediately by return email confirming that you
have and will delete all communications related to the email and any
attachments sent to you in error.*
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
https://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
https://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
Sankhesh Jhaveri
2018-11-26 15:42:38 UTC
Permalink
Yes, all the graphics allocations/deallocations happen during Render. The
render call should ensure that the texture object is bound correctly.
​


On Sun, Nov 25, 2018 at 11:32 AM Matthew Troke <
No I did not - I'm assuming that's important? I appear to be having
trouble binding a texture in a render pass if the texture was created with
another render window as the context.
On Sun, Nov 25, 2018, 10:25 AM Sankhesh Jhaveri <
Post by Sankhesh Jhaveri
Did you call Render on the new render window after adding the renderer
and before invoking the renderer method?
​
On Fri, Nov 23, 2018 at 11:35 AM Elvis Stansvik <
Post by Elvis Stansvik
I think a colleague did something like this for an "export image"
feature at work where we wanted to control the resolution of the exported
inage.
I can have a look at how he worked around gotchas/crashes, but not until
Monday (on my way home).
I think the window and renderer have mutual references to each other and
need to be broken apart in the right order... Something like that..
Elvis
Den fre 23 nov. 2018 17:00Matthew Troke <
Post by Matthew Troke
Once a vtkRenderer is attached to a vtkRenderWindow, can it be removed
and added to a another vtkRenderWindow temporarily to perform an operation
in isolation?
- removed renderer from its current window with RemoveRenderer()
- created a new vtkRenderWindow with vtkNew and added renderer with
AddRenderer()
- I called a method on the renderer (which is my own derived class of
vtkOpenGLRenderer); inside this method, I create a new vtkTextureObject
using the context from the renderwindow and Create2DFromRaw(). This method
fails with an exception in vtkTextureObject::Bind() (Handle is null)
If I don't remove and add the renderer to another window, I don't get
the exception.
--
Matthew Troke
Software Engineer
Office: 1-709-701-0239 <(709)%20701-0239>
*This email and any attachments are confidential and may be privileged.
Any unauthorized use, disclosure, copying or distribution of the
information received is prohibited. If you are not the intended recipient
please contact the sender immediately by return email confirming that you
have and will delete all communications related to the email and any
attachments sent to you in error.*
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
https://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
https://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
*This email and any attachments are confidential and may be privileged.
Any unauthorized use, disclosure, copying or distribution of the
information received is prohibited. If you are not the intended recipient
please contact the sender immediately by return email confirming that you
have and will delete all communications related to the email and any
attachments sent to you in error.*
--
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
Loading...