VisWindow

VisWindow is a class in AVT that represents a visualization window. Plots are added to the VisWindow and it will render them in the VTK renderers that it manages, which can be in on-screen or off-screen windows. There are a number of colleagues inside VisWindow that manage its various behaviors.


Screen Capture

I'm making this section because there are a ton of ScreenCapture, ScreenReadback methods in VisWindow.h. I don't know why there are so many so I'm going to attempt to see what each does. I'm trying to make the viewer obtain z-buffer information in some cases so I can save depth images in addition to RGB.

Method Description
void                 ScreenRender(bool doViewportOnly = false,
                                      bool doZBufferToo = false,
                                      bool doOpaque = true,
                                      bool doTranslucent = true,
                                      bool disableBackground = false,
                                      avtImage_p input = NULL);
  

Force a render of the vis window with these settings. We can use this to render independent parts of the scene (opaque geometry, translucent geometry). The network managers in the engine appear to use this so they can render the scene in passes since they have to composite images together.

avtImage_p           ScreenReadBack(bool doViewportOnly = false,
                             bool doZBufferToo = false, bool captureAlpha = false);
  

Reads the last render into an avtImage object. The avtImage object contains a vtkImageData object that can have 3-4 components and a z-buffer, depending on the arguments. This method is called from VisWindow::ScreenCapture, which does the render needed to get the window in the desired state. The method is also called from the network manager.

    template <typename T>
    void                 ScreenReadBack(T *&r, T *&g, T *&b,
                             T *&a, float *&z, int &w, int &h,
                             bool doViewportOnly, bool doZBufferToo,
                             bool captureAlpha);
  

Reads the last render into independent color channel and Z arrays. The RGBA+Z information is read from the VTK render window in VisWinRendering.h and separated. This code is called in the network manager when it wants to do compositing. I think separate color channels are used for vectorization.

avtImage_p           ScreenCapture(bool doViewportOnly = false,
                                       bool doZBufferToo = false,
                                       bool doOpaque = true,
                                       bool doTranslucent = true,
                                       bool captureAlpha = false,
                                       bool disableBackground = false,
                                       avtImage_p input = NULL);
  

This method does a ScreenRender, followed by a ScreenReadBack and stores the image into an avtImage. This is the main method for getting an image back from the VisWindow. We call this method in the viewer, with all default arguments, which results in a 3-channel image with no Z buffer.

    template <typename T>
    void                 ScreenCapture(T *&r, T *&g, T *&b,
                             T *&a, float *&z, int &w, int &h,
                             bool doViewportOnly, bool doZBufferToo,
                             bool doOpaque, bool doTranslucent,
                             bool captureAlpha, bool disableBackground,
                             avtImage_p input);
  

This method is like the other ScreenCapture method except that it separates the color channels. I've only seen it instantiated for unsigned char.

avtImage_p           PostProcessScreenCapture(avtImage_p capturedImage,
                                       bool doViewportOnly, bool keepZBuffer);
  

This method lets us write an image into the render window and then draw the foreground annotations (like legends) onto it and then return an image that has those additions. The resulting image is 3-channel with no Z buffer.