[vtkusers] Mac offscreen drawing

Chris Scharver scharver at evl.uic.edu
Tue Jun 15 14:44:28 EDT 2004


On Jun 15, 2004, at 9:59 AM, Paul Schmiedge wrote:

> On Jun 14, 2004, at 12:32 PM, Chris Scharver wrote:
>
>> What exactly is it that you're trying to do? Would it be possible to 
>> use an existing rendering window at all? Maybe just the built-in VTK 
>> functions to save render windows to a file and then quit? Since MacOS 
>> X requires windows are created in order to achieve hardware 
>> acceleration, the only difference may be that the windows actually 
>> appear on the screen. This could at least let you save a series of 
>> images in batch mode for the time being.
>
> A series of images generated in batch mode is exactly what I'm aiming 
> for.  I know how to save the images I'm rendering to a file, and that 
> works just fine.  I'd like to render without a window appearing 
> on-screen because the batch rendering process is being initiated by 
> another program, which then loads the produced images to display to 
> the user for further interaction.  Since the user will be sitting at 
> the computer during this process, a bunch of pop-up windows behind the 
> main application is hardly desirable.

Okay, this sounds like it should be doable. Since the user is sitting 
at the screen, it is no problem to create hardware accelerated windows. 
The only difference for MacOS X offfscreen rendering is that the 
windows are never displayed to the screen. For Carbon windows, I think 
that ShowWindow() just has to not be called. Similarly, Cocoa windows 
should call [NSWindow setFrame: display:NO]. I'll do some digging to 
see if I can find a simple example of a working offscreen window.

> Is it possible to use the Carbon HideWindow() function in conjunction 
> with the WindowPtr from vtkCarbonRenderWindow?  I've tried it, but the 
> window still appears briefly.

That will hide the window, but the vtkCarbonRenderWindow and 
vtkCocoaRenderWindow classes both automatically display windows when 
they are created. They just don't have the logic for offscreen 
rendering in their window initialization methods. I'll play around with 
the code this week to see if I can get anything working, but it looks 
like it should be a matter of setting an offscreen flag and 
subsequently not displaying the windows to the screen during 
initialization. Probably easier said then done. :)

Chris

--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>




More information about the vtkusers mailing list