#region --- License --- /* Licensed under the MIT/X11 license. * Copyright (c) 2006-2008 the OpenTK Team. * This notice may not be removed from any source distribution. * See license.txt for licensing detailed licensing details. */ #endregion using System; using System.Collections.Generic; using System.Text; namespace OpenTK.Graphics { /// Defines the format for graphics operations. public class GraphicsFormat { private ColorMode color_format, auxilliary_color_format; int depth, stencil, buffers; bool stereo; #region --- Constructors --- /// Constructs a new GraphicsFormat from the given GraphicsFormat. /// #region public GraphicsFormat(GraphicsFormat mode) public GraphicsFormat(GraphicsFormat mode) : this(mode.ColorMode, mode.Depth, mode.Stencil, mode.AuxilliaryColorFormat, mode.Buffers, mode.Stereo) { } #endregion #region public GraphicsFormat() /// Constructs a new GraphicsFormat with sensible default parameters. public GraphicsFormat() : this(DisplayDevice.PrimaryDisplay.BitsPerPixel, 16, 0, 0, 2, false) { } #endregion #region public GraphicsFormat(ColorMode color) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. public GraphicsFormat(ColorMode color) : this(color, 16, 0, 0, 2, false) { } #endregion #region public GraphicsFormat(ColorMode color, int depth) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. /// The number of bits in the depth buffer. public GraphicsFormat(ColorMode color, int depth) : this(color, depth, 0, 0, 2, false) { } #endregion #region public GraphicsFormat(ColorMode color, int depth, int stencil) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. /// The number of bits in the depth buffer. /// The number of bits in the stencil buffer. public GraphicsFormat(ColorMode color, int depth, int stencil) : this(color, depth, stencil, 0, 2, false) { } #endregion #region public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. /// The number of bits in the depth buffer. /// The number of bits in the stencil buffer. /// The ColorMode of the auxilliary buffer. public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux) : this(color, depth, stencil, aux, 2, false) { } #endregion #region public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux, int buffers) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. /// The number of bits in the depth buffer. /// The number of bits in the stencil buffer. /// The ColorMode of the auxilliary buffer. /// The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering). public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux, int buffers) : this(color, depth, stencil, aux, buffers, false) { } #endregion #region public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux, int buffers, bool stereo) /// Constructs a new GraphicsFormat with the specified parameters. /// The ColorMode of the color buffer. /// The number of bits in the depth buffer. /// The number of bits in the stencil buffer. /// The ColorMode of the auxilliary buffer. /// Set to true for a GraphicsFormat with stereographic capabilities. /// The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering). public GraphicsFormat(ColorMode color, int depth, int stencil, ColorMode aux, int buffers, bool stereo) { this.ColorMode = color; this.Depth = depth; this.Stencil = stencil; this.AuxilliaryColorFormat = aux; this.Buffers = buffers; this.Stereo = stereo; } #endregion #endregion #region --- Public Methods --- #region public int ColorMode /// /// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode. /// public ColorMode ColorMode { get { return color_format; } private set { color_format = value; } } #endregion #region public int AuxilliaryColorFormat /// /// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode. /// public ColorMode AuxilliaryColorFormat { get { return auxilliary_color_format; } private set { auxilliary_color_format = value; } } #endregion #region public int Depth /// /// Gets a System.Int32 that contains the bits per pixel for the depth buffer /// of this DisplayMode. /// public int Depth { get { return depth; } private set { depth = value; } } #endregion #region public int Stencil /// /// Gets a System.Int32 that contains the bits per pixel for the stencil buffer /// of this DisplayMode. /// public int Stencil { get { return stencil; } private set { stencil = value; } } #endregion #region public bool Stereo /// /// Gets a System.Boolean indicating whether this DisplayMode is stereoscopic. /// public bool Stereo { get { return this.stereo; } private set { this.stereo = value; } } #endregion #region public int Buffers /// /// Gets a System.Int32 containing the number of buffers associated with this /// DisplayMode. /// public int Buffers { get { return this.buffers; } private set { this.buffers = value; } } #endregion #region public static GraphicsFormat Default /// Returns an OpenTK.GraphicsFormat compatible with the underlying platform. public static GraphicsFormat Default { get { return new GraphicsFormat(DisplayDevice.PrimaryDisplay.BitsPerPixel, 16, 0, 0, 2, false); } } #endregion #endregion } }