[vtkusers] Importing images drawn into a memory based device context (DC) into VTK

Emiliano Beronich emiliano at veccsa.com
Thu May 6 11:18:02 EDT 2004


Hi!

I have done this before in windows in the way suggested by Ingo.
I draw a bitmap on the background of the window where RenderWindow is 
rendering with BitBlt before calling Render(). We can call 
GetDC(RenderWindow->GetWindowId()) for the DC of the RenderWindow. When 
we set the pipeline is necessary to add the following lines:

Renderer->SetLayer(0);
RenderWindow->AddRenderer(Renderer);
RenderWindow->NumberOfLayer(2);

I don't think the order of the lines is important as far as doing it 
before calling render().
With Renderer we still have the interaction with the mouse. We can draw 
anything on that. If what we need is interacting with the image, I think 
the best way is to define our own derived InteractionStyle class to pick 
the events and do what we want. For example, we can catch a mouse click 
and find out if an actor or the background (when no actor) was picked 
and after that define our desired behaviour. Another possibility is to 
manage the messages of the window outside vtk (via WindowProc) if the 
interaction needed is basically with the image (x, y position) but not 
with actors.

Regards,
Emiliano




John Biddiscombe wrote:

>>>2- Import the background map as an image into the VTK
>>>pipeline. (How can
>>>I do this if the image is drawn into memory which I only have a device
>>>context (DC) pointer to?)
>>
>>Do not know that... But maybe you can make the image as a texture
>>and use a vtkPlaneSource, set it somewhere in the back and take
>>away all mouse interaction with it ?? This actually reminds me, that
>>I need this kind of behaviour ;)
>>
> 
> 
> Add a method to vtkOpenGlRenderWindow like
> SetBackgroundImage(byte*, int width, int height)....
> 
> Then do a copy of the image to the gl context before rendering, but after
> clearing the back buffer (or use it to clear the back buffer directly if it
> fills the window)
> 
> I'm looking at similar things, because I'm rendering to an offscreen
> Hardware accelerated pBuffer to generate an image, and then want to inject
> this image into the vtk pipeline, possibly as a texture, possibly as a depth
> map etc. There is scope for adding some new functionalities to the
> renderwindow.
> 
> Anyone done any of this already?
> 
> JB
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 




More information about the vtkusers mailing list