[vtkusers] Mac offscreen drawing

Chris Scharver scharver at evl.uic.edu
Mon Jun 14 14:32:59 EDT 2004


On Jun 14, 2004, at 10:47 AM, Paul Schmiedge wrote:

> I've been scouring the archives for this list, but I can't seem to 
> find a way to accomplish my goal - Does anyone know how to accomplish 
> batch-oriented offscreen rendering on OSX (10.3)?  I'm not using 
> Objective C, so Cocoa is not an option, but I am willing to use Carbon 
> or Apple's X11 if I have to.  I've experimented with both so far, but 
> the call to vtkXOpenGLRenderWindow::SetOffScreenRendering() results in 
> an error for X11 (bad memory access), and there seems to be no effect 
> when the same call is made on any other window type.  I've also 
> studied the Tcl example for Mangled Mesa, but I'm not sure if that's 
> an option for OSX, or how I would go about setting it up on this 
> platform.

Apple's X11 does not support offscreen OpenGL rendering, you won't be 
able to get it with an X11 build. As far as I can tell, neither the 
Carbon nor Cocoa VTK implementation has offscreen rendering implemented 
yet. MacOS X OpenGL windows must be created (whether actually shown or 
not) in order to be hardware accelerated. This means that one must be 
logged in as the current user. From Apple's OpenGL documentation, 
"Currently, no hardware accelorators support acclerated off-screen 
buffers via CGLSetOffscreen. It is recommended developers use the Cocoa 
OpenGL classes or AGL to create and attach a context to a hidden 
window, thus getting a fully accelerated off-screen buffer. The frame 
buffer contents can be read via glReadPixels or used as a texture via 
the copy and/or surface texture functions."

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.

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