vtkOpenGLOffscreenRenderWindow
Description
Use in place of a vtkRenderWindow to draw an offscreen
image. This is specifically for Unix/OpenGL/X11 systems.
There is already a vtkWin32OffscreenRenderWindow in the
contrib directory of VTK to cover Windows systems. For
SGI systems, it will use pbuffers for hardware
accelerated offscreen rendering. For all other architectures,
it will use GLX pixmaps which tend to be software-rendering
(except for hardware-accelerated Mesa).
Download
Usage
- On SGI systems compile with
-DUSE_PBUFFER
in
the CFLAGS
variable in the makefile
in order to
enable hardware accelerated rendering. On all other
architectures (including older pre-Impact SGIs) use
-DUSE_PIXMAP
to compile it for software
rendering. You
can edit the Makefile
to do this. (there
ain't much to it)
- The
Makefile
will build two example
programs; vtkSphere_ex and glxpixmap_ex.
vtkSphere_ex will simply draw a vtkSphere offscreen and
write it into a PPM image file called "sphere.ppm".
glxpixmap_ex is a super-simple example of how the
pixmap stuff is implemented in the VTK version.
- In your program you must turn
ImmediateModeRendering on.
This means either using
vtkMapper::GlobalImmediateModeRenderingOn()
or for each vtkMapper use
mapper->SetImmediateModeRenderingOn().
- DO NOT use a
vtkRenderWindowInteractor
with this unless
you want to cause it to crash with extreme prejudice.
Other than that, you can use it just like you would
another vtkRenderWindow
.
- DO NOT use SetFullScreen() mode with this since
there is no screen to test against. The pixmap will not
respond correctly to X11 queries that were intended for
mapped windows.
- This has never been used in stereo mode.
Caveats
- The offscreen renderer cannot handle vtkTexture
directly due to some hardcoding in vtkOpenGLRenderWindow. So
you will need to use the vtkOpenGLOffscreenTexture classes
( which are now included with this distribution) which
were supplied by Randy
Heiland of NCSA.
- So far
I have been able to test on RedHat Linux 6.2 with Mesa and
on SGI IRIX 6.4/6.5 systems (Impact,Octane and Onyx IR).
I know that others have tested on SGI O2 and Sun workstations.
That isn't a whole lot of systems, so I'm interested in any
feedback about what systems it works/doesn't work on. The
example program glxpixmap_ex.cc can be used as a simplified
testbed to debug problems that might arise. The code in
this example is the template for the vtk offscreen window.
- Rendering using the USE_PIXMAP version is really slow.
There is really no way around this since it has to do with
the vendor implementation of OpenGL rather than the
methodology used. I wish hardware accelerated offscreen
rendering was more widely available as part of standard
OpenGL implementations.
- The system has been modified so that multiple PBUFFERS can
be used simultaneously. However, it does incurr a performance cost by
forcing the contents of the buffer to be copied out after every frame
so as to preserve its contents and yield the buffer to other users on
a system. You can get faster performance by putting the system into
"exclusive" mode though. To do this, remove the
#define
USE_CLOSEDISPLAY
from the top of the
vtkOpenGLRenderWindow.cxx code. This will not yield the
framebuffer between rendered frames thereby creating faster renders,
but at the cost of making the framebuffer owned exclusively by a
single renderer (no other user on the entire system will be granted
access to this pipe until the offscreen renderwindow is destroyed).
Last modified: Wed Nov 22 15:18:07 PST 2000