=============
Anti-Aliasing
=============

HOOPS/3dGS supports line, text and full-screen antialiasing.

Full Screen Anti-Aliasing
=========================

This is currently supported by the HOOPS 3D drivers (DX11, OpenGL and OpenGL2). Attempts to use this feature will have no effect when print or 2D drivers are used (postscript, image, gdi, etc...). It will only be available if the graphics hardware supports full-screen anti-aliasing. Additionally, we have found that on Windows, some display control panel settings (e.g. stereo) will cause some systems to not offer anti-aliasing support, even if the underlying hardware is capable of it.  

Therefore, support must first be 'requested' by calling ``Set_Driver_Options( "anti-alias" )`` prior to the first update of a driver instance. During the first update, HOOPS/3dGS will attempt to create a display context that has anti-aliasing capability. To find out whether the resulting driver instance is actually anti-alias capable, call ``Show_Device_Info( "anti-alias", tempstr )`` after the first update has been performed. The answer written into tempstr will be either "yes" or "no". For DX11 and OpenGL2 drivers, you can adjust the "anti-alias" option after the initial update.
  
If anti-aliasing is available for a driver instance, it can then be enabled on a per segment basis like any other attribute by calling setting the "anti alias suboption" in ``Set_Rendering_Options``.

You can specify the level of anti-aliasing resolution by setting the anti-alias option to an integer value:

.. tabs::

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

.. csv-table::

	.. image:: images/065aantialiasno.png, .. image:: images/065aantialias4x.png

*The anti-aliasing turned off on the left image and anti-aliasing turned on to 4 in the right image.*


Text and Line/Edge Anti-Aliasing
--------------------------------

This is supported on a platform independent basis, but performance will vary depending on the amount of text/lines/edges, and the active driver. These capabilities are enabled by setting the 'lines' and 'text' "anti alias suboptions", as discussed in ``Set_Rendering_Options``. When anti-aliasing is enabled for 'lines', all 'lines' and 'text' in the active segment will be rendered with anti-aliasing.

The previous image shows the effect of anti-aliasing. The sphere on the left is drawn normally, while the sphere on the right is drawn using anti-aliasing. Note how the 'stairstepping' on slanted edges is softened. 

.. csv-table::

	.. image:: images/0634a_normal_sphere.jpg, .. image:: images/0634a_aliased_sphere.jpg
	
*Normal and anti-aliased spheres*
