PowerStorm 4DxxT V5.10 Release Notes

»

HP Tru64 UNIX

Tru64 UNIX

» Tru64 UNIX V5.1B-6
» Tru64 UNIX V5.1B-5
» Documentation
» Information library
» Software web index
» Software products library
» Patch database
» Services
» Developer & Solution Partner Program
» Send us your comments
» Support Statements

Evolving business value

» Tru64 UNIX to HP-UX 11i transition benefits calculator
» Alpha RetainTrust Program
» Transition

Related links

» Alpha systems
» HP-UX 11i
» Integrity servers
» Linux
» HP storage
» HP solutions
HP-UX 11i: measurably better TCO!


Compaq 4DT3D Version 5.10

PowerStorm 4D40T/4D50T/4D60T/4D51T UINX Graphics Support for
Tru64  UNIX V5.1A


Compaq Computer Corporation
Marlboro, Massachusetts
Release Notes
December 2000


Possession, use, or copying of the software described in this publication
is authorized only pursuant to a valid written license from Compaq or an
authorized sublicensor.

Compaq Computer Corporation makes no representations that the use of its
products in the manner described in this publication will not infringe on
existing or future patent rights, nor do the descriptions contained in this
publication imply the granting of licenses to make, use, or sell equipment
or software in accordance with this description.

Copyright @  Compaq Computer Corporation 2000
All rights reserved.

AlphaServer, AlphaStation, DEC, DEC PHIGS, DEC Open3D, DECwindows, Digital,
Compaq Open3D, DIGITAL PHIGS, OpenVMS, TURBOchannel and the Digital logo
are trademarks of Compaq Computer Corporation.

Compaq, the Compaq logo, the Digital logo, and PowerStorm are registered in
the United States Patent and Trademark Office.

The following are third-party trademarks:

Motif is a registered trademark of The Open Group in the United States and
other countries
OpenGL is a registered trademark of Silicon Graphics, Inc.
PostScript and Display PostScript are registered trademarks of Adobe
Systems, Incorporated.
UNIX is a registered trademark in the United States and other countries
licensed exclusively through X/Open Company Ltd.
X Window System is a trademark of the Massachusetts Institute of
Technology.


Preface

This document contains the release notes for Compaq PowerStorm
4D40T/4D50T/4D51T/4D60T UNIX Graphics Support for
Tru64 UNIX V5.1A

Release notes are supplied in ASCII format and is located in the
following location:

   * /usr/lib/4DT510/4dt3d510.release_notes

     CHAPTER 1
     PRODUCT INSTALLATION OVERVIEW

The following devices are supported:

   * PCI-based based PowerStorm 4D40T, 4D50T, 4D51T & 4D60T


This release contains software for the following specific graphics options:

   *  PowerStorm 4D40T, PowerStorm 4D50T, PowerStorm 4D51T, PowerStorm 4D60T

This release contains optional support for the following:

   * OpenGL.
   * Overlay Support via Extended Visuals

          1.1 Required License


          Compaq  software requires a Compaq Open3D Product
          Authorization Key (PAK) for 3D server operation. This PAK should
          come in hardcopy with this software, and should be registered
          before you install this software. If you do not register the PAK
          before starting the software, the server will run in 2D mode only
          (no OpenGL server support).

          1.2 Prerequisite Software


          You can install this software  only on systems that
          are running Tru64 UNIX Version 5.1A. Before installing
          4DT3D, you must remove all previous versions from the system.
          After you have installed this version, if you upgrade or reinstall
          the operating system version, you must first deinstall this software.
          Once the operating system change has been made, then reinstall this
          graphics software.

          In order to use the PowerStorm 4D51T, the workstation or server
          must have a firmware level of the SRM Console of at least
          6.7-250. If newer firmware is necessary, it may be obtained from
          the following WWW site:

          ftp://ftp.digital.com/pub/DEC/Alpha/firmware/index.html


          1.3 Problem Reporting


          Problems should be reported using the standard Integrated Problem
          Management Tool (IPMT).

          1.4 Installing 4DT on Compaq Tru64 UNIX Systems


          When installing 4DT, you should note the following:

          The Compaq 4DT3D Extensions Clause is required for all graphics
          options supported. In multihead configurations
          you must edit the configuration file and rebuild the kernel
          manually. Please refer to the installation guide for more
          details.

               1.4.1 Organization of the 4DT510 Kit


               The 4DT510 kit has five subsets:

                4DTZE3510    Provides basic 4DT device support.
                             This subset is Mandatory.
                4DTCONFIG510 Makes sure that your system is configured properly
                             after installation. This subset is Mandatory.
                4DTGLBASE510 Provides OpenGL support. This subset is Optional.
                4DTGLEXAM510 Contains OpenGL examples. This subset is Optional.
                4DTGLMAN510  Contains OpenGL Man pages. This subset is Optional.

               "Mandatory", means that if you install the 4DT510 kit, those
               subsets will be installed unconditionally. The installation
               procedure will however allow you to choose among the Optional
               subsets. If you choose not to install the kit at all, no subsets
               will be installed.

               Note that the supported graphics options are enabled only after
               you install the kit.

               Optional subsets can not be installed without the Mandatory
               subsets, but if you install the 4DT kit without installing
               one or more of the Optional subsets, any of the omitted
               Optional subsets can be installed at a later time without
               re-installing the Manadatory subsets.

               You may have to edit some server configuration files before
               rebooting the system. See Section 1.4.2 for more information
               on editing the configuration files.

               1.4.2 Modifications to /usr/var/X11/Xserver.conf


               The Xserver configuration file /usr/var/X11/Xserver.conf
               contains startup information for the server. The X server
               reads and acts on certain options and information in this
               file.

                    1.4.2.1 Compaq 4DT 3D Extensions Clause


                    The GLBASE subset installation adds the Compaq 4DT3D
                    extensions clause, which causes the Xserver to load
                    these extensions. If you do not want the installation
                    to load some of the extensions, remove the appropriate
                    lines from  /usr/var/X11/Xserver.conf file.

                    The Compaq 4DT 3D extensions clause is as follows(note
                    the nesting of < > pairs):

! Start 4DT 3D Extensions List

extensions <
      < _dec_GLX lib_dec_GLX.so __GLX_LoadInit GLX >
      < directx       libdirectx.so  DirectXInit >
      <  extMultibuf  libextMultibuf.so       MultibufferExtensionInit >
      < _dec_glXDECpeer lib_dec_glXDECpeer.so InitglXDECExtension DEC-PEER-GLX >
>
! End 4DT 3D Extensions List

                    If the extensions clause is not in the file
                    Xserver.conf, the server will not load the 3D
                    extensions.


          1.5 Alternate Console


          Instead of using the graphics display as the system console, it is
          possible to attach an external ASCII terminal to serial port 1 and
          have console interactions take place on that device. This is done at
          the boot prompt (>>>). To use an external terminal, the commands are:

            >>> set console serial 
            >>> init 

          To return to the graphics display as console, the commands are:

            >>> set console graphics 
            >>> init 

     CHAPTER 2
     NEW WITH THIS RELEASE

     Compaq 4DT3D Version 5.10 supports Compaq Tru64 UNIX 5.1A.

     This section describes new and changed functionality that is being
     released for the first time with Version 5.10.


          2.1 New Hardware


          There is no new hardware supported with this release.

          2.2 New Software


          No new software is included in this release.

          2.3 Problems fixed in this release


	  This is the baseline release for UNIX5.1A

          2.4 Internet Distribution and Installation


          The Compaq 4DT3D software will be made available via the
          Internet. Please use the following procedure to locate the kit.

          1. Using a web browser, access URL
          http://www.support.compaq.com/open3d/ . Click on "Mature Products".

          2. Pick 4DT3D for Compaq Tru64 UNIX 5.1A  Kit to ftp the
          kit.

          3. Use tar to extract the files from 4DT510.tar into a
          directory: tar -xvf 4DT510.tar

          4. Use setld to load the kit: setld -l 4DT510

          In addition to the released software, this site also contains
          pointers to these release notes and to later, field-test versions
          of software. The site http://www.compaq.com/support/ also
          contains pointers to other software and software patches.


     CHAPTER 3
     RELEASE INFORMATION FOR POWERSTORM 4D40T, 4D50T, 4D51T, 4D60T

          3.1 Product Summary


          Compaq 4DT3D Version 5.10 supports Compaq Tru64 UNIX 5.1A.

          Compaq 4DT3D Version 5.10 contains the graphics support for the
          PowerStorm models 4D40T, 4D50T, 4D51T and 4D60T. The software has
          several components:

          * Device Dependent Code for the X server 2D graphics support. This
            piece of code is mainly used for connections over an external
            network.
          * OpenGL Direct Rendered graphics support libraries. These libraries
            are used by applications written to the OpenGL V1.1 standard.
          * Direct Rendered X11. These libraries replace the existing Xlib and
            increase the performance of X applications when run locally.

                                      NOTE

          There is no PEX support for any of the PowerStorm 4D40T, 4D50T,
          4D51T, 4D60T boards.

          3.2 Prerequisite Hardware


          The AlphaStations which support these devices are listed in the
          Software Product Description (SPD). To get the expected performance
          from these graphics options, an AlphaStation with a CPU
          clock-speed of 266 MHz or higher is recommended.

          3.3 After the Installation


          Once the installation of the PowerStorm 4D40T, 4D50T, 4D51T and
          4D60T software has been completed, the machine needs to be
          rebooted. This reboot will enable the graphics devices.

          3.4 Known Restrictions


          This section of the document contains known restrictions with the
          current software.

               3.4.1 General Restrictions

               These restrictions apply to all applications and graphics
               interfaces.

                    3.4.1.1 Applications That Link With Static Libraries


                    Applications which link against the static libraries
                    (.a files) provided in previous releases of Compaq
                    Open3D or Compaq Tru64 UNIX, will not work correctly.
                    Applications linking against static libraries should be
                    re-linked to use the shareable object libraries. Future
                    bugfixes and performance optimizations will be
                    automatically available to these applications, without
                    further re-linking. (If an application must be linked
                    against a static library, it must be (re-)linked
                    against a static library from this release.)

                    3.4.1.2 Multihead Support with the PowerStorm 4D40T,
                    4D50T, 4D51T and 4D60T


                    The default behavior for two multi-head cards in an
                    AlphaStation 600 is: The console output will go to the
                    monitor attached to the bottom-most card. When the server
                    starts up, screen 0 will be the top-most card. If it is
                    preferable for the console output and screen 0 to be
                    displayed on the same monitor, this can be achieved by
                    disabling the VGA on the bottom-most card via a jumper in
                    the upper left hand corner of the graphics card.

                    Additional multihead support is defined through the matrix
                    given in the Software Product Description (SPD).

               3.4.2 OpenGL Restrictions


               This section describes restrictions in the OpenGL software
               in this release.

                    3.4.2.1 Applications Coded to Request Indirect
                    Rendering Only


                    The PowerStorm 4D40T, 4D50T, 4D51T and 4D60T graphics
                    boards are specifically optimized to run Direct
                    Rendered OpenGL applications. Some applications have
                    been coded to request Indirect Rendered OpenGL
                    rendering contexts. Those applications will not perform
                    optimally on these graphics boards.

                    By default OpenGL software for PowerStorm 4D40T, 4D50T,
                    4D51T and 4D60T returns a Direct Rendered OpenGL
                    rendering context whenever the connection is "direct",
                    i.e., when DISPLAY is :0 or direct:0. If necessary,
                    this behavior can be overridden by defining this
                    environment variable:

                    setenv ALLOWINDIRECT 1

                    3.4.2.2 GLX Pixmap Support


                    No GLXPixmap rendering is supported for contexts marked
                    direct.

                    3.4.2.3 Texture Image Size Limitation


                    There is a limitation on the Texture Image size in this
                    release: the maximum of either height or width of
                    texture images is 1024.

                    3.4.2.4 4D Vertex Handling Incorrect in Some Cases


                    There are several cases of 4D vertices that are not
                    handled correctly.

                    3.4.2.5 MIPMAP Rendering


                    If the range of 1/W (inverse W) values for vertices is
                    very large, then the texture mapping with mipmaps may
                    exhibit some artifacts.

                    3.4.2.6 GLUT Restrictions


                    The glutIdleFunc(func) call does NOT store the current
                    context along with the function func. When func is
                    called, therefore, the current context is
                    unpredictable. func should always do a glutSetWindow()
                    call before any other drawing operations.

                    3.4.2.7 Primitives Outside a glBegin/glEnd Block


                    If vertex calls are placed in a display list and
                    executed without first calling glBegin, the server may
                    generate Graphic Engine errors. This can also cause the
                    server to hang, requiring a reinitialization and reboot
                    of the system. This should only happen when there are
                    programming errors, since all drawing is required to be
                    between glBegin and glEnd calls.

                    3.4.2.8 Antialiasing in Color Index Mode


                    The antialiasing modes (GL_POINT_SMOOTH, GL_LINE_SMOOTH,
                    and GL_POLYGON_SMOOTH) and color index mode do not work
                    correctly together. Flat-shaded lines and polygons do not
                    get drawn. Smooth-shaded objects do get drawn, but they
                    do not use the correct color indices.

               3.4.3 Performance and System Characteristics


               The PowerStorm 4D40T, 4D50T, 4D51T and 4D60T subsystem is
               significantly different from other graphics devices provided by
               Compaq. It differs in the following ways:

               * Direct Rendering OpenGL. All previous products. Some
                 applications have been written assuming indirect rendering
                 only. These programs will run on the PowerStorm 4D40T, 4D50T,
                 4D51T and 4D60T boards, although they will not perform
                 optimally.
               * Client Side Display Lists. When OpenGL display lists use direct
                 rendering, these lists are stored in the same address space as
                 the application code and data. When compared to other graphics
                 hardware, the user address space requirements will be higher.
                 However, the overall memory requirements (i.e., the virtual
                 space for the client and the server) should be the same or
                 smaller. The implication is that a larger user virtual address
                 space may be required.
               * Direct Rendered X11 2D. Much of the 2D graphics is also direct
                 rendered by default. This gives much better performance when
                 the number of objects provided to xlib routines are small. Some
                 applications have been written to assume a client/server model.
                 These should run without change. To get the error detection
                 that the protocol provides, change the DISPLAY environment
                 variable to be 'unix:0' and the application will run without
                 the benefit of direct rendering.

                    3.4.3.1 Texture Mapping and Performance


                    Many applications use multiple texture maps. It is
                    suggested that applications that require multiple
                    textures be written (or rewritten) to use the OpenGL
                    1.1 texture object functionality or the Texture Object
                    Extension.

                    3.4.3.2 OpenGL Pixmap Performance


                    The OpenGL specification precludes direct rendering to
                    pixmaps. This limits the performance of drawing to
                    GLXPixmaps. To use GLXPixmaps when running on a local
                    (:0 or direct:0) display, create an indirect rendering
                    context and set the following environment variable:

                    setenv ALLOWINDIRECT 1

                    It is recommended that any application that extensively
                    uses GLXPixmap drawing be recoded to use drawing to the
                    back buffer. The performance will be significantly
                    better on this and most other OpenGL-based graphics
                    options.

                    3.4.3.3 RGB Format


                    Some graphics options from Digital used a
                    non-standard format for 24-plane TrueColor pixel
                    formats call "BGR". In this format, the least
                    significant 8 bits of the pixel correspond to the blue
                    component, while the most significant 8 bits correspond
                    to the red component.

                    The PowerStorm 4D40T, 4D50T, 4D51T and 4D60T graphics
                    option uses the opposite format called "RGB" which
                    allows better performance with OpenGL-based
                    applications. On the PowerStorm 4D60T option, there are
                    two 32-plane RGBA visuals (single and double-buffered)
                    for OpenGL where the most significant 8 bits correspond
                    to the OpenGL "alpha" buffer. In the double-buffered
                    RGBA visual, the color components are double-buffered
                    while the alpha component is single-buffered.

                    Care must be taken to supply the color components of
                    images in the correct order. In particular, the color
                    components of images obtained from other graphics
                    devices may need to be re-ordered. (Applications
                    written to TrueColor that did not specifically look at
                    the visual information to determine the location of the
                    color values may look like red and blue are swapped,
                    i.e., objects that were blue will be red on these
                    graphics options.)

                                              NOTE

                    On all PowerStorm 4D40T, 4D50T, 4D51T and 4D60T options
                    running under UNIX, there is also an 8-plane TrueColor
                    visual *not* supported by OpenGL. This visual is in
                    "BGR" format where the least-significant 2 bits are the
                    blue component, the next 3 bits are the green
                    component, and the most significant 3 bits are the red
                    component.

                    3.4.3.4 Usage of Shared Memory by the PowerStorm 4D40T,
                    4D50T, 4D51T and 4D60T

                    In order to improve performance, the PowerStorm 4D40T,
                    4D50T, 4D51T and 4D60T systems make extensive use of shared
                    memory to send information to the server. Shared memory is
                    used for the following types of data:

                    * X connections when using the DISPLAY :0
                    * OpenGL rendering contexts
                    * Texture map data

                    However, the system imposes a limit on the number of shared
                    memory segments that a process can access concurrently and
                    the total amount of shared memory the system allows. At
                    times, an X client may run up against this limit. If this
                    occurs, client applications will display the following
                    warning: "dxlib warning: server shmget failed" or other
                    errors from applications indicating that they are out of
                    memory when using some of the above types of data.

               3.4.4 PowerStorm 4D40T, 4D50T, 4D51T, 4D60T Supported Video
               Modes


               The following table lists the supported video modes for the
               PowerStorm 4D40T, 4D50T, 4D51T, and 4D60T.

               Supported Video Modes (*=default)
               ---------------------------------------------------------------
               Resolution  4D60T               4D40/50/51T
               (Hor x Ver) Refresh Rates       Refresh Rates
               ----------- ---------------     -------------------
               1920x1200   60..65              not available
               1920x1080   60..75; 60*         not available
               1600x1280   60..75; 70*         not available
               1600x1200   60..80; 75*         not available
               1280x1024   60..85, 66, 72; 75* 60..85, 66, 72; 75* (a)
               1152x900    60..95; 76*         60..95; 76* (a)
               1024x768    60..115; 75*        60..115; 75*
               1024x864    60..140; 60*        60..140; 60*
               800x600     60..140, 72; 75*    60..140, 72; 75*
               720x400     70                  70
               640x480     60..150, 72; 75*    60..150, 72; 75*
               512x512     60                  60

               (a) Supported, but backing store may not be available at
               this resolution. (See note at end of this section.)

               Each supported graphics mode can be selected by starting the
               Xserver with the appropriate command-line arguments. These
               command line arguments are as follows:

               * -screen  Selects the desired screen resolution.
               * -vsync  Selects the desired screen refresh rate.
               * -I -e3bpp  Selects the desired number of video planes.

               The -screen and -vsync options should be used in conjunction with
               each other. Using the -vsync option alone will not work. Using
               the -screen option alone will select the proper screen
               resolution, but may select an incompatible refresh rate.

               The -screen and -vsync options must select one of the supported
               modes from the above table. Using unsupported combinations of
               -screen and -vsync may produce undesirable results. The only
               possible values that can be used with the -e3bpp option are 102
               and 128. Other values are invalid.

               Note the use of the -I argument in conjunction with the -e3bpp
               option. The -I argument indicates to the server that all
               following arguments are device-specific and should be ignored by
               the device-independent layer of the server. For this reason,
               device-dependent options, such as -e3bpp, should come last on
               the Xserver command line, and should be preceded by a -I
               argument. Only one -I argument is necessary, regardless of the
               number of device-dependent options.

               To change the command-line arguments that the Xserver uses, login
               as root and edit the file /usr/var/X11/Xserver.conf. Search for
               the following lines in this file, which indicate the command-line
               arguments:

! 4DXXT Server args start
        -pn -nice -2 -bs -su
! 4DXXT Server args end

               Append your changes to the arguments already listed, and then
               restart the server. You may prefer to log in remotely to do this.

               The default graphics mode for the 4D40T and 4D50T graphics
               options are 1280x1024 @ 75Hz, in 102-plane mode. This is
               equivalent to the following command-line options:

! 4DXXT Server args start
        -pn -nice -2 -bs -su -screen 1280x1024 -vsync 75 -I -e3bpp 102
! 4DXXT Server args end

               The default graphics mode for the 4D60T graphics option is
               1280 x 1024 @75Hz, in 128-plane mode. This is equivalent to the
               following command-line options:

! 4DXXT Server args start
        -pn -nice -2 -bs -su -screen 1280x1024 -vsync 75 -I -e3bpp 128
! 4DXXT Server args end

               To run a PowerStorm 4D40T, 4D50T, 4D51T or 4D60T in 128-plane
               mode at 1024x768 @ 70Hz, use the following command-line options:

! 4DXXT Server args start
        -pn -nice -2 -bs -su -screen 1024x768 -vsync 70 -I -e3bpp 128
! 4DXXT Server args end

               To restore the default graphics mode, simply remove all of the
               -screen, -vsync, and -e3bpp options from the command line in
               /usr/var/X11/Xserver.conf. If there are no other device-dependent
               options, remove the -I argument as well.

                                      NOTE

               In order to improve performance, the PowerStorm 4D40T, 4D50T,
               4D51T, 4D60T family of graphics options uses offscreen video
               memory to provide backing store for certain types of clients.
               These clients include all OpenGL clients, and X clients that
               are rendering to the display :0.

               In some graphics modes, there may not be enough offscreen video
               memory to provide backing store. In cases where backing store is
               required, switching to a lower resolution or changing from
               128-plane mode to 102-plane mode will reserve enough offscreen
               memory to provide backing store.

               3.4.5 Enabling Save Unders and Backing Store for 4D40T,
               4D50T, 4D51T, 4D60T Devices


               The default condition of all graphics devices except the
               PowerStorm 4D40T/4D50T/4D51T/4D60T is to enable both backing
               store and save unders. For the PowerStorm 4D40T/4D50T/4D51T/4D60T
               devices, the default condition remains to disable backing store
               and save unders. In order to enable backing store and save
               unders, add these arguments to /var/X11/Xserver.conf:
               "-I +e3bs +e3su ". The line to edit is near the end
               of the file, where the arguments ("args") are added, and looks
               like this:

! you specify command line arguments here
args <
! 4DXXT Server args start
        -pn -nice -2 -bs -su
! 4DXXT Server args end
        -pn
>

               Add this string: "-I +e3bs +e3su" to the end of the last line.
               The resulting "args" lines look like this:

! you specify command line arguments here
args <
! 4DXXT Server args start
        -pn -nice -2 -bs -su -I +e3bs +e3su
! 4DXXT Server args end
        -pn
>

               After making this edit, shutdown the machine and re-boot.


     CHAPTER 4
     CORE SERVER FUNCTIONALITY FOR GRAPHICS ACCELERATORS


          4.6 Overlay Support


               4.6.1 Technical Background


               The overlay window is a PseudoColor visual. Pixel 0 is
               always the transparent pixel.

               To get the visualID of the overlay visual, you need to get
               the SERVER_OVERLAY_VISUALS property from the root window. To
               retrieve the property and interpret the data associated with
               it, consider the following example:

               property_name: SERVER_OVERLAY_VISUALS
               property_type: SERVER_OVERLAY_VISUALS
               format: 32

               The contents of the property is a LIST of the following data
               structure:

               SERVER_OVERLAY_VISUALS {
               overlay_visual: VISUALID
               transparent_type: {None, TransparentPixel, TransparentMask}
               value: CARD32
               layer: CARD32
               }

               For the devices with overlay planes, the server returns a
               list that contains one element. The element consists of four
               long-words, as described above.

               You would typically receive the following information:

               0x00000027 /* VisualID */
               0x00000001 /* Indicates that the transparent_type is
                             TransparentPixel */
               0x00000000 /* The transparent pixels value is 0 */
               0x00000001 /* The layer is 1 */

               Once you have the VisualID, you can retrieve the rest of the
               information about the overlay visual and colormap by calling
               the routine XGetVisualInfo.

               Overlay windows and regular windows are in different layers,
               so drawing in an overlay window will not disturb the pixels
               of the regular window, and vice versa. If you draw an
               invisible pixel into an overlay window, the pixel of the
               nonoverlay window beneath that window will show through.

               4.6.2 Motif Window Manager for Overlays


               Compaq Tru64 UNIX supplies a Motif window manager with an option
               to support overlays. This is located in /usr/bin/X11. However,
               this window manager option (mwm -Overlay) has numerous problems
               and is not recommended or supported.

               It is strongly suggested that you share colormaps with the window
               manager, as the hardware supports only one colormap for the
               overlay planes. This can be achieved by querying the server
               property name SERVER_OVERLAY_COLORMAPS. This property will return
               the 32-bit value that is the overlay colormap ID. If you create
               and install your own colormap, you will have overlay colormaps
               alternating on the screen, which will have the effect of changing
               the colors of the window managers borders and banners.


          4.7 Multiple Colormaps


          Options with multiple colormaps support multiple,
          simultaneously-installed colormaps.

          Applications should not install or deinstall colormaps
          themselves. The window manager should perform these actions.
          However, the application is responsible for providing the window
          manager with hints as to which colormaps to install or deinstall.
          You provide this information using the Xlib function
          XSetWMColormapWindows(). This function sets the WM_COLORMAP_
          WINDOWS property for a given window.

          For information on how to use this function and how the window
          manager interprets the property, see The X Window System by
          Scheifler and Gettys, 3rd Edition (Section 14.1.11, Setting and
          Reading the WM_COLORMAP_WINDOWS Property, pages 425-426, and
          Section 4.1.8, Colormaps, page 649-651).

          Applications written and debugged on systems with only one
          colormap may appear incorrect on a system with multiple
          colormaps. There are several application errors that can cause
          this, but the most prevalent is not having the correct colormap
          associated with all the windows that require it. To correct this
          problem, use XChangeWindowAttributes to set the colormap for all
          windows in the application that require the colormap.



     CHAPTER 5
     KNOWN RESTRICTIONS AND PROBLEMS

     This section describes the known restrictions with the 5.10 versions of
     Compaq 4DT3D.



          5.2 X Restrictions
1<

          This section describes restrictions related to the X Window
          System.

               5.2.1 Backing Store Support


               Backing store requires significant amounts of off-screen
               memory. If a small piece of a window is occluded, the
               off-screen memory requirements for the window depend on the
               size of the window, not on the occluded fragment. (This is
               the design of backing store as supplied by the X
               Consortium.)

               This memory requirement can cause problems. When this memory
               is used up, the performance is degraded. For example, if you
               see unacceptable pauses in the windowing system when pulling
               down menus or changing window focus, these are probably
               caused by backing store.

               Therefore, Compaq recommends that you use backing store
               sparingly, and try to have only one window on the screen
               that requests backing store. This allows extra room in
               off-screen memory for pixmaps. If you continue to have
               problems that you suspect are caused by backing store, you
               can disable this option and try the operation again.

               To turn off backing store and save unders, add the options
               "-bs -su" to the command line arguments in the
               /usr/var/X11/Xserver.conf file:

! you specify command line arguments here
args <
! 4DXXT Server args start
        -pn -nice -2 -bs -su
! 4DXXT Server args end
        -pn
>

                                           NOTE

               You should save the original /usr/var/X11/Xserver.conf file
               before editing it.

               If an args command does not exist in the file
               /usr/var/X11/Xserver.conf, add one at the end of the file:

! you specify command line arguments here
args <
        -pn -nice -2 -bs -su
>

               To have your edits taken into account, you must stop and
               restart the server. To stop the server, enter the command:

               # /sbin/init.d/xlogin stop

               The server will exit. Then, log in to the system as root and
               enter the following command to restart the server:

               # /sbin/init.d/xlogin start

               5.2.2 Save Under Support


               Save unders are disabled by default. The X Consortium
               implementation of save unders turns on backing store for
               occluded windows, however, which potentially uses large
               amounts of off-screen memory and causes performance to
               degrade. For example, when save unders are enabled, you may
               see pauses in menu and windowing operations as backing store
               is enabled and disabled on windows that are under menus.

               5.2.3 Multihead Support


               * The specification for multihead support for graphics options is
                 now contained in the Software Product Description (SPD) for
                 Open3D.


          5.4 OpenGL Restrictions


          This section describes restrictions on using OpenGL software.

               5.4.1 Non-Compaq Example Imakefiles


               Compaq has included in this release a modified version of
               the OpenGL example code available via anonymous ftp from
               SGI. Although the source code from SGI should compile and
               run unaltered on a Compaq system, it may not. Compaq has
               corrected problems with 64-bit integers and pointers that
               are not apparent on a 32-bit SGI system.

               In addition, the Imakefiles from SGI are not portable. If
               you want to build the example code, we strongly recommend
               that you use the sources provided by Compaq in
               /usr/examples/GL. Because the Imakefiles and Makefiles
               provided by SGI will not work correctly on a Compaq Tru 64
               UNIX system, you must at least use the Compaq-supplied
               Imakefiles to produce a Makefile. To make a Makefile from an
               Imakefile, use the xmkmf command in the directory containing
               the Imakefile.

               5.4.2 Antialiased Operations


               The following restrictions apply to antialiased operations:

               * Antialiased polygons for OpenGL are not supported. The
                 primitives are rendered, but not antialiased.
               * OpenGL antialiased lines may not be rendered completely within
                 the OpenGL specifications.


          5.7 Problem with Diskless Management System (DMS) Support


          The 4DT3D software installs files in directories that are
          considered "write only" by the Diskless Management System (DMS)
          standards. Operation of 4DT3D devices in a DMS environment may
          not be correct. This is under review for a change in a future
          release.

          5.12 Slow Dragging of Opaque Windows


          There have been reports that dragging opaque windows on
          PowerStorm 4D40T/4D50T/4D51T/4D60T systems is slow. This can only
          be improved by changing window to drag in Outline Mode.

          5.13 OpenGL Sample and Example Programs May Not Build Correctly


          The previous Open3D release contained several kitting errors
          which prevented correct compilation of the OpenGL sample and
          example programs. While most of these have been fixed, a few
          remain in this kit and are noted here.

               5.13.1 Missing Source Files and Directories


               The glut examples in /usr/examples/GL/libglut is missing
               the progs/sgi-stereo example files. They are omitted
               because they use a stereo method that is not supported
               by 4DT.

               When you build the libglut examples, it will fail when
               it tries to build progs/sgi-stereo. Since it is the
               last item to be built, all other glut examples and libglut.so
               should have been built. They have not been fully tested
               however, so Compaq recommends that you use the existing
               library /usr/shlib/libglut.so rather than the one you
               built in /usr/examples/GL/libglut/lib/glut/libglut.so .

               These glut examples and library are old, newer versions of
               glut can be downloaded from http://reality.sgi.com/opengl/glut3/.
               These newer versions sometimes do not compile right away
               on Tru64 UNIX.

               There is no glx_samples directory.

               5.13.2 Incomplete Makefiles


               The make Makefiles will not build all programs automatically. The
               ones that do not build automatically can be built by moving to
               the correct subdirectory and manually invoking the Imake script.


          5.16 Console Display on Multihead Systems


          In general, the console display output in multihead systems will
          appear on the monitor attached to the graphics card installed in the
          lowest-numbered slot in the workstation. (Refer to the manuals that
          came with the workstation to determine the slot-numbering order.)


     CHAPTER 6
     Application Notes for OpenGL Stereo Rendering for
     PowerStorm 4D40T, 4D50T, 4D51T and 4D60T

     This section is intended to give a brief overview of the stereo
     implementation that is available for the PowerStorm 4DT family of
     graphics adapters. OpenGL stereo as described in this document is
     currently only supported on Compaq Tru64 UNIX.

     This document does not discuss algorithms for generating stereo views
     from a 3D scene, and it does not discuss how to write a stereo
     application using OpenGL. (Although an example of a simple stereo
     application is given at the end of this document). The OpenGL stereo
     implementation for the PowerStorm 4D40, 4D50, 4D51, 4D60T family was
     intended to be as transparent as possible, and thus take advantage of
     pre-existing (and well-documented) API's.

     This version of this document describes the stereo capabilities of the
     PowerStorm 4DT series of graphics adapters, as implemented in Compaq
     Open3D Version 4.96. Customers using beta or field test versions of
     software that include stereo support for this series of graphics
     adapters are encouraged to upgrade, as this release contains numerous
     bug fixes and improvements.

          6.1 Stereo Support


          Stereo support for the Powerstorm 4D40T, 4D50T, 4D51T, 4D60T
          family of graphics adapters conforms to the model defined by the
          OpenGL standard. An application can render a stereoscopic scene
          by simply drawing to the appropriate left or right buffers. The
          hardware mechanics of rendering in stereo mode are completely
          transparent to the applications developer.

          The form of stereo rendering that has been implemented is
          commonly referred to as 'stereo-in-a-window'. A stereo scene can
          be rendered into a normal window on the screen. Pixels that are
          displayed in a stereo window will have a normal aspect ratio.

          Other monoscopic applications can displayed on the same screen,
          and will appear normal. Multiple stereo windows and monoscopic
          windows can be displayed simultaneously, can overlap and can be
          managed by a standard window manager.

          6.2 Enabling Stereo from an Application


          To enable stereo rendering, two things must be done. The graphics
          adapter must be using a screen resolution that supports stereo,
          and an application must select a visual or pixel format that
          supports stereo.

          To determine if your current configuration will support stereo,
          use a program such as xglinfo to list all of the visuals that GL
          supports. If you see visuals that have the 'STEREO' attribute,
          then stereo will be available to applications that request it. If
          you only see visuals with the 'MONO' attribute, then either your
          software is not correctly installed or you have selected a screen
          resolution that does not support stereo. See the section titled
          Supported Screen Resolutions and Refresh Rates to make sure that
          you have selected a resolution that supports stereo.

          From a user program, you can determine if the system is stereo
          capable by calling glXGetConfig() with the requested attribute
          set to GLX_STEREO.

          For an OpenGL implementation layered on the X Window System,
          simply use glXChooseVisual() to select an appropriate stereo
          visual. Use glXCreateContext() to create a new GLX rendering
          context using the visual that was selected. When the application
          calls glXMakeCurrent() with this context, the screen will be
          switched into stereo mode, and rendering can proceed as normal.

          The same effect can be achieved using a GL toolkit that supports
          stereo. For example, when using the OpenGL Utility Toolkit
          (GLUT), simply OR in the GLUT_STEREO bit to the mode argument
          when calling glutInitDisplayMode().

          Selecting the left or right stereo buffer is accomplished through
          the standard call to glDrawBuffer(). When the context or window
          used for stereo rendering is destroyed, the screen is switched
          back out of stereo mode. If multiple contexts are being used for
          stereo rendering, the screen is not switched out of stereo mode
          until the last of these contexts is destroyed.

          6.3 Supported Hardware


          This stereo implementation requires a PowerStorm 4D40T, 4D50T,
          4D51T or 4D60T graphics adapter and compatible MultiSync monitor.
          StereoGraphics and NuVision stereo hardware are both supported by
          this implementation.

          Note that the stereo connector on the back of the PowerStorm 4DT
          cards is different from the stereo connector on the back of other
          Digital graphics adapters. Contact the manufacturer of your
          stereo hardware to obtain the proper cables to connect your
          stereo hardware to your PowerStorm 4D40T, 4D50T, 4D51T, 4D60T
          card. The cable should match the mini-DIN connector on the back
          of the PowerStorm card.

          6.4 Supported Screen Resolutions and Refresh Rates


          In order to support normal aspect ratio pixels in stereo mode,
          the frame buffer is divided into two full height left and right
          buffers.

          Because of the increased memory requirements associated with
          maintaining separate left and right buffers, the maximum screen
          resolution for each graphics adapter will be slightly smaller
          than in non-stereo mode.

          Maximum Stereo Resolutions

          PowerStorm Model   Planes Per        Max
                                Pixel       Resolution
          --------------------------------------------
          4D60T                 102         1280x1024
                                128         1152x900
          4D50T/4D40T/4D51T     102         800x600
                                128         800x600


          To select a particular screen resolution and vertical refresh
          rate, use the '-screen' and '-vsync' command line options in the
          X server configuration file.

          To select an additional vertical refresh rate to be used when the
          screen is in stereo mode, use the '-I -e3stereo ' command
          line arguments in the Xserver configuration file. Replace 
          by one of the vertical refresh rates in the table below. Note
          that the maximum refresh rates indicated may not be supported by
          all hardware, nor by all monitors.

          If you omit the '-I -e3stereo ' arguments in the Xserver
          configuration file, the server will continue to use the same
          refresh rate that it was using when the screen was in monoscopic
          mode. This will be the value that was specified with the '-vsync'
          parameter, or the default refresh rate for this resolution.

          The first time that the screen is switched into stereo mode, the
          Xserver will print out the refresh rate that is being used for
          stereo. If no '-vsync' or '-e3stereo' arguments were given, the
          Xserver will note that stereo mode is using the default refresh
          rate. This information can be found in the Xserver error log
          (/var/dt/Xerrors or /var/X11/xdm/xdm-errors).

          See your system administrator or refer to your documentation and
          release notes for more information on configuring the Xserver via
          the configuration file.

          The following table lists all of the resolutions and
          corresponding vertical refresh rates supported by PowerStorm
          4D40T, 4D50T, 4D51T, 4D60T graphics adapters. Note that not all
          of these resolutions are supported in all configurations. (For
          example, only the 4D60T is capable of the highest resolutions,
          and the very highest require a 4D60T operating in 102 bpp mode).
          To determine the maximum possible stereo resolution for a given
          configuration, consult the previous table.

          There are no real restrictions on the refresh frequency that is
          used at a given resolution. You may pick any of the available
          frequencies for the resolution you have chosen, within the limits
          of your display hardware.

          Note also that these refresh rates are per frame, so in stereo
          mode, divide by two to get the effective refresh rate per eye. In
          the comment column, The asterisk ('*') indicates the default
          refresh rate for a particular resolution. This is the value that
          you should get if you select this resolution and do not use the
          '-vsync' option. A frequency range of "xx..yy" indicates that the
          entire range is supported, in 5 Hz intervals.

          Supported Video Modes
          ------------------------------------------------------------

          Resolution  4D60T               4D40T, 4D50T, 4D51T

          (Hor x Ver) Refresh Rates       Refresh Rates
          ----------- ---------------     -------------
          1920x1200   60..65              not available
          1920x1080   60..75; 60*         not available
          1600x1280   60..75; 70*         not available
          1600x1200   60..80; 75*         not available
          1280x1024   60..85, 66, 72; 75* 60..85, 66, 72; 75*
          1152x900    60..95; 76*         60..95; 76*
          1024x768    60..115; 75*        60..115; 75*
          1024x864    60..140; 60*        60..140; 60*
          800x600     60..140, 72; 75*    60..140, 72; 75*
          720x400     70                  70
          640x480     60..150, 72; 75*    60..150, 72; 75*
          512x512     60                  60

          6.5 Supported Visuals


          [NOTE: the following information applies only to OpenGL
          implementations layered on the X Window System.]

          GL stereo is currently supported on single and double buffered
          TrueColor-24 and PseudoColor-8 visuals. Future support will
          include DirectColor visuals.

          6.6 Backing Store


          [NOTE: the following information applies only to OpenGL
          implementations layered on the X Window System.]

          Backing store is currently not supported when rendering in stereo
          mode. Windows that have their backing store attribute set will
          have backing store turned off while the screen is in stereo mode
          and will receive exposure events.

          When the screen returns to monoscopic mode, these windows will
          have backing store re-enabled. Backing store for any obscured
          regions will have been lost, but will be available for subsequent
          window operations.

          6.7 Performance


          When the graphics adapter is in stereo mode, the rendering
          performance of monoscopic applications will be lower than normal.
          Because of this, it is recommended that when stereoscopic
          rendering is no longer required, the adapter be switched out of
          stereo mode.

          This reduction in performance is most apparent in applications
          that draw large, simple primitives. Large rectangle fills are the
          best example of this. Rendering complex three-dimensional scenes
          with many polygons or textured polygons should not suffer
          significant performance degradation.

          Switching between normal and stereo modes is fairly expensive, so
          switching back to normal mode is only required when it is
          unlikely that stereo rendering will be performed in the near
          future. An application that renders in both mono and stereo
          should remain in stereo mode for as long as stereo rendering is
          required.

          6.8 Left and Right Construction Planes


          [NOTE: the following information applies only to OpenGL
          implementations layered on the X Window System.]

          As described above, in this stereo implementation, the frame
          buffer is divided into separate full-height left and right
          buffers. This means that when the screen is in stereo mode, the
          left and right buffers use separate portions of the frame buffer
          for the construction planes. (Depth buffer, alpha buffer, and
          stencil buffer).

          This does not cause problems in normal rendering, but it can
          cause unexpected results when an application reads and writes to
          these buffers. OpenGL implicitly assumes that there is only one
          of each of these construction buffers.

          In the case of an application that reads from these planes (via
          glReadPixels), data will always be fetched from the buffer
          associated with the left stereo buffer. When an application
          writes to these buffers (via glDrawPixels) the data is replicated
          and sent to both the left and right buffers.

          Note that having separate depth, stencil, and alpha buffers for
          the left and right stereo buffers will not cause problems for
          monoscopic applications that are running when the screen is in
          stereo mode. For these applications, the same information is
          rendered in both the left and right buffers, so both sets of
          construction planes will be identical.

          6.9 Common Questions


          [NOTE: the following information applies only to OpenGL
          implementations layered on the X Window System.]

          Q: I tried to start a stereo application, but it couldn't find an
          appropriate visual. What gives?

          A:  In later versions of the stereo
          software, if the Xserver is running at a resolution that does not
          support stereo, then no GL visuals that support stereo will be
          available. Again, check to make sure that you are using a
          resolution that supports stereo. (You can use the program
          'xglinfo' to see what GL visuals are available).

          Q: When I am running an application in stereo mode, why don't
          certain things always get redrawn properly?

          A: If your application does not handle expose events, or relies
          on backing store to handle redraws of obscured areas, you may
          experience problems when running in stereo mode, since backing
          store is turned off.

          Q: I have an application that uses DECstereo. Will it work with a
          PowerStorm 4D40T, 4D50T, 4D51T, 4D60T card?

          A: No. DECstereo is not supported on these cards.

          Q: When I run 'xstereo -i', it says that the display is not
          stereo capable.

          A: (See the previous question). xstereo works with the older
          DECstereo, and is not supported on the PowerStorm 4D40T, 4D50T,
          4D51T, 4D60T series cards.

          Q: I need to have my X-only application render in stereo. How do
          I do this?

          A: Right now, stereo is only supported for GL applications.

          6.10 Application Example


          Demonstration of a simple stereo application in OpenGL and GLUT. This
          application puts a crude stereo image of a paper airplane on the
          screen, rotating about its center.

          This program uses perspective depth, which draws things in the
          distance smaller. The only correct way to do this in gl is with the
          "window" subroutine made to perform asymmetric projection by the use
          of parallel cameras. It is incorrect to angle the cameras inward so
          that their lines of gaze intersect at a point in space.

          For orthographic display (no perspective -- things in the distance
          drawn the same size as things up close) it is correct to angle the
          cameras inward. The gl "perspective" may be used in this case if one
          wishes.


          For proposed standards for stereoscopic display see "Stereo Image
          Display on Microcomputers" by Dennis J. Adams and Albert F. G. Xthona,
          available free from:

            StereoGraphics Corporation
            2171 East Francisco Blvd.
            San Rafael, CA 94901
            (415) 459-4500

          The original version of the program before modification, was by Robert
          Akka published in The CrystalEyes Handbook, distributed by
          StereoGraphics. Richard Bradley at StereoGraphics states that the
          original program is in the public domain.

Permission to use, copy, modify, and distribute this software for any
purpose and without fee is hereby granted, provided that this permission
notice appears on all copies of the software. The name of IBM Corporation
may not be used in any advertising or publicity pertaining to the use of
the software. IBM makes no warranty or representations about the
suitability of the software for any purpose. It is provided "AS IS" without
any express or implied warranty, including the implied warranties of
merchantability, fitness for a particular purpose and non-infringement. IBM
shall not be liable for any direct, indirect, special, or consequential
damages resulting from the loss of use, data, or projects, whether in an
action of contract or tort, arising out of or in connection with the use or
performance of this software.

Permission to use, copy, modify, and distribute this software for any
purpose and without fee is hereby granted, provided that this permission
notice appears on all copies of the software. The software is provided "AS
IS" without any express or implied warranty, including the implied
warranties of merchantability, fitness for a particular purpose and
non-infringement. Digital Equipment Corporation (DEC) shall not be liable
for any direct, indirect, special, or consequential damages resulting from
the loss of use, data, or projects, whether in an action of contract or
tort, arising out of or in connection with the use or performance of this
software. Except as contained in this notice, the name of DEC shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this software without prior written authorization from DEC.

/*
 *
 * plane.c (OpenGL version)
 * Draws rotating paper airplane in stereo.
 *
 * Converted to use OpenGL Utility Toolkit
 * Rick Hammerstone, Digital, December 1996.
 *
 * Converted to OpenGL by Silicon Graphics Corp. 4Dgifts program toogl.
 * Further modified by James S. Lipscomb and Keh-Shin Cheng, IBM Research,
 * March 1995. Uses Motif.
 *
 * Original program in GL by Robert Akka
 * StereoGraphics Corporation
 * April 2, 1991
 *
 * Compile with:
 * cc -o plane plane.c -lglut -lGLU -lGL -lXmu -lXi -lXext -lX11 -lm
 *
 * Hit  to stop program.
 */

#include 
#include 
#include 
#include 

/*
 * Speed of rotation in degrees per update.
 */

#define VELOCITY -0.2
float yAngle = 0;
GLenum rgb, doubleBuffer;

void Reshape(int width, int height)
{
  glViewport(0, 0, width, height);
}

void Key(unsigned char key, int x, int y)
{
  if (key == 27)
    exit(0);
}

void Init()
{
  glMatrixMode(GL_PROJECTION);
}

void DrawAirplane()
{
  static float airplane[9][3] = {
    { 0.0,  0.5, -4.5 },
    { 3.0,  0.5, -4.5 },
    { 3.0,  0.5, -3.5 },
    { 0.0,  0.5,  0.5 },
    { 0.0,  0.5,  3.25},
    { 0.0, -0.5,  5.5 },
    {-3.0,  0.5, -3.5 },
    {-3.0,  0.5, -4.5 },
    { 0.0, -0.5, -4.5 }
  };

  glColor3f(1.00, 0.19, 0.69); /* violet: r=1, g=.19, b=.69 */

  glBegin(GL_LINE_LOOP);
    glVertex3fv(airplane[6]);
    glVertex3fv(airplane[7]);
    glVertex3fv(airplane[1]);
    glVertex3fv(airplane[2]);
    glVertex3fv(airplane[4]);
  glEnd();

  glBegin(GL_LINE_LOOP);
    glVertex3fv(airplane[0]);
    glVertex3fv(airplane[4]);
    glVertex3fv(airplane[5]);
    glVertex3fv(airplane[8]);
  glEnd();

  glBegin(GL_LINE_LOOP);
    glVertex3fv(airplane[6]);
    glVertex3fv(airplane[3]);
    glVertex3fv(airplane[2]);
  glEnd();
}

void Plane(float yAngle)
{

  glRotatef(yAngle, 0, 1, 0); glRotatef(-10, 1, 0, 0);
  DrawAirplane();

}

void StereoProjection(float left, float right,
                      float bottom, float top,
                      float near, float far,
                      float zero_plane, float dist,
                      float eye)
{
  /*
   * Perform the perspective projection for one eye's subfield. The
   * projection is in the direction of the negative z axis.
   *
   *   -6.0, 6.0, -4.8, 4.8,
   *
   * left, right, bottom, top = the coordinate range, in the plane of zero
   * parallax setting, which will be displayed on the screen. The ratio
   * between (right-left) and (top-bottom) should equal the aspect ratio
   * of the display.
   *
   *   6.0, -6.0,
   *
   * near, far = the z-coordinate values of the clipping planes.
   *
   *   0.0,
   *
   * zero_plane = the z-coordinate of the plane of zero parallax setting.
   *
   *   14.5,
   *
   * dist = the distance from the center of projection to the plane
   * of zero parallax.
   *
   *   -0.31
   *
   * eye = half the eye separation; positive for the right eye subfield,
   * negative for the left eye subfield.
   */

  float xmid, ymid,
        clip_near, clip_far,
        topw, bottomw,
        leftw, rightw,
        dx, dy,
        n_over_d;

  dx = right - left;
  dy = top - bottom;

  xmid = (right + left) / 2.0;
  ymid = (top + bottom) / 2.0;

  clip_near = dist + zero_plane - near;
  clip_far  = dist + zero_plane - far;

  n_over_d = clip_near / dist;

  topw = n_over_d * dy / 2.0;
  bottomw = -topw;

  rightw = n_over_d * ( dx / 2.0 - eye);
  leftw  = n_over_d * (-dx / 2.0 - eye);

  /* Need to be in projection mode for this. */

  glLoadIdentity();
  glFrustum(leftw, rightw, bottomw, topw, clip_near, clip_far);
  glTranslatef(-xmid - eye, -ymid, -zero_plane - dist);
}

void DrawScene(void)
{

  glDrawBuffer(doubleBuffer ? GL_BACK : GL_FRONT);
  glClearColor(0.0, 0.0, 0.0, 0.0);

  glClear(GL_COLOR_BUFFER_BIT);

  glDrawBuffer(doubleBuffer ? GL_BACK_LEFT : GL_FRONT_LEFT);

  glPushMatrix();
    StereoProjection(-6.0, 6.0, -4.8, 4.8, 6.0, -6.0, 0.0, 14.5, -0.31);
    Plane(yAngle);
  glPopMatrix();

  glDrawBuffer(doubleBuffer ? GL_BACK_RIGHT : GL_FRONT_RIGHT);

  glPushMatrix();
    StereoProjection(-6.0, 6.0, -4.8, 4.8, 6.0, -6.0, 0.0, 14.5, 0.31);
    Plane(yAngle);
  glPopMatrix();

  if (doubleBuffer)
    glutSwapBuffers();
  else
    glFlush();

  yAngle -= VELOCITY;
  if (yAngle < 0)
    yAngle = 360.0 + yAngle; /* degrees */
}

GLenum Args(int argc, char **argv)
{
  GLint i;

  rgb = GL_TRUE;
  doubleBuffer = GL_TRUE;

  for (i = 1; i < argc; i++) {
    if (strcmp(argv[i], "-ci") == 0) {
      rgb = GL_FALSE;
    }
    else if (strcmp(argv[i], "-rgb") == 0) {
      rgb = GL_TRUE;
    }
    else if (strcmp(argv[i], "-sb") == 0) {
      doubleBuffer = GL_FALSE;
    }
    else if (strcmp(argv[i], "-db") == 0) {
      doubleBuffer = GL_TRUE;
    }
    else {
      printf("%s (Bad option).\n", argv[i]);
      return GL_FALSE;
    }
  }

  return GL_TRUE;
}

int main(int argc, char **argv)
{
  GLenum type;

  glutInit(&argc, argv);
  Args(argc, argv);

  type = GLUT_STEREO;
  type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
  type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;

  glutInitDisplayMode(type);
  glutInitWindowSize(300, 300);
  glutCreateWindow("Airplane");

  Init();
  glutReshapeFunc(Reshape);
  glutKeyboardFunc(Key);

  glutIdleFunc(DrawScene);
  glutDisplayFunc(DrawScene);

  glutMainLoop();

  return 0;
}