==============
Stereo viewing
==============

Stereo viewing is a more advanced viewing mode which enables the user to view the scene in a virtual 3D mode where the scene is 'floating' in front of the viewer, rather than being projected from 3D to 2D and drawn flat on the screen. HOOPS provides the software-level support for stereo viewing. However, this  viewing mode also requires special hardware, including a display driver (and graphics card) that provides support for stereo viewing, and a set of stereo glasses. The driver-specific sections in the HOOPS/3dGS Platform and Device Guide provide information about whether a particular driver supports stereo viewing. 

Stereo viewing is enabled in HOOPS via the following steps:

1. Set the 'stereo' option on the appropriate HOOPS display driver; this must be performed before the driver instance has been created (before the first call to ``Update_Display``). During the first update, HOOPS/3dGS will attempt to create an OpenGL display context that has stereo viewing capability. To find out whether the resulting driver instance is actually "stereo" capable, call ::Show_Device_Info(".", "stereo", tempstr ) after the first update has been performed. The answer written into tempstr will be either "yes" or "no".

2. If stereo viewing is available, it can then be enabled on a per segment basis by setting the "stereo suboption" in ``Set_Rendering_Options``:

.. tabs::

	.. group-tab:: C++
	
		.. literalinclude:: ../../../../hoops_3df/demo/common/sanity/0700_docs_0024.cpp
		   :start-after: //! [stereo1]
		   :end-before: //! [stereo1]
		   
If the scene has already been drawn using a driver that did not have the stereo attribute initially set, then stereo viewing will not be available on that driver. The following provides an example of how to enable stereo viewing:
 
.. tabs::

	.. group-tab:: C++
	
		.. literalinclude:: ../../../../hoops_3df/demo/common/sanity/0700_docs_0024.cpp
		   :start-after: //! [stereo2]
		   :end-before: //! [stereo2]

Then, the stereo mode could be dynamically turned off and on by unsetting and setting the rendering option.

HOOPS/3dGS also allows you to modify the "stereo separation", which refers to the degree of offset between the two views. (In review, to support stereo viewing, HOOPS/3dGS internally draws the scene twice using different oblique projections.) The default stereo separation is ~ 3 degrees, but can be modified if necessary by setting::
 
	HC_Set_Rendering_Options("stereo separation = [ # of degrees]");  

In HOOPS/3dGS, you can set the position of the stereo focal plane using the "stereo distance" option. This option determines the focal plane's distance from the camera and is given in camera eye distance. Note that the "stereo distance" is relative to the camera target.  A positive value indicates that the focal plane is behind the target while a negative value indicates that the focal plane is in front of the target. The default value for "stereo distance" is 0 which sets the focal plane at the camera target.
