[vtk-developers] Drawing on a vtkRenderWindow in C#/ActiViz

Clinton Stimpson clinton at elemtech.com
Wed Sep 14 10:10:57 EDT 2011


I prefer the approach of using OpenGL to draw the extra stuff in the 
vtkRenderWindow.  Another vtkActor is usually an easy way to go.

One could also do things like turning off SwapBuffers, call 
vtkRenderWindow::Render(), draw extra things on the scene using OpenGL, then 
swap buffers manually.  Some GUI toolkits provide OpenGL based painting 
routines to make this easier.

A native OpenGL approach avoids the overhead of copying the window contents.

But yeah, its not uncommon to have problems when trying to draw with OpenGL 
and draw without OpenGL and expect it to be shown together in the same window.

I'm not sure if this is related to or is the root of this problem, but see the 
end of this articles for an explaination of what developers must worry about 
when trying to mix GDI with OpenGL 
http://www.opengl.org/pipeline/article/vol003_7/.

Clint

On Wednesday, September 14, 2011 07:15:56 am David Cole wrote:
> If you want to do your own drawing, perhaps you should just have an
> invisible/hidden vtkRenderWindow, and then grab its output with a
> vtkWindowToImageFilter (
> http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html )
> 
> After that, you can simply use the image returned from that to draw it
> as a bitmap in your own drawing context, and then draw on top of it.
> 
> Or maybe somebody else listening here has done something similar and
> can suggest another alternative?
> 
> 
> HTH,
> David
> 
> On Wed, Sep 14, 2011 at 7:28 AM, cakbulut <cakbulut at web.de> wrote:
> > Hello together,
> > 
> > I have already asked a similar question in context of Java.
> > http://vtk.1045678.n5.nabble.com/Drwaing-on-a-vtkActor-in-Java-td4631768.
> > html
> > 
> > Now I have changed the language in the hope that the problem do not occur
> > in C#.
> > 
> > But it has.
> > 
> > I am loading a DICOM image into a vtkRenderWindow. After that I'm taking
> > the Graphics of the vtkRenderWindow and try to draw a Point or rectangle
> > onto the DICOM image. But always all the drawn Graphics are behind the
> > vtkRenderWindow.
> > 
> > So I thought maybe it would work if I inherit the vtkRenderWindow and
> > override the OnPaint() method. But the result is the same like above.
> > 
> > The third stuff which I have also tried is that I have put the
> > vtkRenderWindow into a Panel (mainPanel). After that I have added
> > additional Panels into the mainPanel. But the added Panel is behind the
> > vtkRenderWindow.
> > 
> > As far as I have seen the vtkRenderWindow is a UserControl.
> > Normally it is possible to draw on a UserControl.
> > 
> > What is so special in vtkRenderWindow???
> > Is there a solution for this problem???
> > 
> > Best regards
> > cakbulut
> > 
> > --
> > View this message in context:
> > http://vtk.1045678.n5.nabble.com/Drawing-on-a-vtkRenderWindow-in-C-ActiV
> > iz-tp4802425p4802425.html Sent from the VTK - Dev mailing list archive at
> > Nabble.com.
> > _______________________________________________
> > Powered by www.kitware.com
> > 
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > 
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com



More information about the vtk-developers mailing list