function str = opengl(mode)
%OPENGL Change automatic selection mode of OpenGL rendering.
%   The auto selection mode of OpenGL is only relevant when the
%   RendererMode of the FIGURE is AUTO.
%   OPENGL AUTOSELECT allows OpenGL to be auto selected if OpenGL
%   is available and if there is graphics hardware on the host machine.
%   OPENGL NEVERSELECT disables auto selection of OpenGL.
%   OPENGL ADVISE prints a string to the command window if OpenGL
%   rendering is advised and does not select OpenGL.
%   OPENGL, by itself, returns the current auto selection state.
%
%   Note that the auto selection state only specifies that OpenGL
%   should or not be considered for rendering, it does not
%   explicitly set the rendering to OpenGL.  This can be done by
%   setting the Renderer property of FIGURE to OpenGL,
%   e.g. set(GCF, 'Renderer','OpenGL');    

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.2 $  $Date: 1998/12/02 21:43:22 $

if (nargin == 0)
  current_setting = feature('openglmode');
  switch(current_setting),
    case 0,
      str = 'NeverSelect';
    case 1,
      str = 'Advise';
    case 2
      str = 'AutoSelect';
  end
else
  switch(lower(mode)),
    case 'neverselect',
      setting = 0;
    case 'advise',,
      setting = 1;
    case 'autoselect',
      setting = 2;
    otherwise,
      error('OpenGL auto mode settings are autoselect, advise, and neverselect');
  end
  feature('openglmode',setting);
end
