Renamed GraphicsFormat to GraphicsMode.

This commit is contained in:
the_fiddler 2008-02-28 15:26:13 +00:00
parent bb88b25239
commit ee1431279f
10 changed files with 42 additions and 42 deletions

View file

@ -24,7 +24,7 @@ namespace Examples.WinForms
[Example("Extensions", ExampleCategory.WinForms, 3)] [Example("Extensions", ExampleCategory.WinForms, 3)]
public partial class W03_Extensions : Form public partial class W03_Extensions : Form
{ {
GLControl glControl = new GLControl(GraphicsFormat.Default); GLControl glControl = new GLControl(GraphicsMode.Default);
Type glClass; Type glClass;
Type delegatesClass; Type delegatesClass;
Type importsClass; Type importsClass;

View file

@ -307,9 +307,9 @@ namespace OpenTK
#endregion #endregion
internal GraphicsFormat ToGraphicsFormat() internal GraphicsMode ToGraphicsFormat()
{ {
return new GraphicsFormat(this.Color.BitsPerPixel, this.DepthBits, this.StencilBits, 0, this.AuxBits, this.Buffers, this.Stereo); return new GraphicsMode(this.Color.BitsPerPixel, this.DepthBits, this.StencilBits, 0, this.AuxBits, this.Buffers, this.Stereo);
} }
#region --- Overrides --- #region --- Overrides ---

View file

@ -23,7 +23,7 @@ namespace OpenTK
public partial class GLControl : UserControl public partial class GLControl : UserControl
{ {
IGraphicsContext context; IGraphicsContext context;
GraphicsFormat format; GraphicsMode format;
IGLControlHelper helper; IGLControlHelper helper;
#region --- Constructor --- #region --- Constructor ---
@ -32,7 +32,7 @@ namespace OpenTK
/// Constructs a new GLControl. /// Constructs a new GLControl.
/// </summary> /// </summary>
public GLControl() public GLControl()
: this(GraphicsFormat.Default) : this(GraphicsMode.Default)
{ } { }
/// <summary> /// <summary>
@ -43,7 +43,7 @@ namespace OpenTK
: this(mode.ToGraphicsFormat()) : this(mode.ToGraphicsFormat())
{ } { }
public GLControl(GraphicsFormat format) public GLControl(GraphicsMode format)
{ {
InitializeComponent(); InitializeComponent();
@ -119,7 +119,7 @@ namespace OpenTK
if (context != null) if (context != null)
throw new InvalidOperationException("GLControl already contains an OpenGL context."); throw new InvalidOperationException("GLControl already contains an OpenGL context.");
if (format == null) if (format == null)
format = GraphicsFormat.Default; format = GraphicsMode.Default;
if (!this.DesignMode) if (!this.DesignMode)
{ {
@ -221,7 +221,7 @@ namespace OpenTK
/// <remarks> /// <remarks>
/// To change the GraphicsFormat, you must destroy and recreate the GLControl. /// To change the GraphicsFormat, you must destroy and recreate the GLControl.
/// </remarks> /// </remarks>
public GraphicsFormat GraphicsFormat public GraphicsMode GraphicsFormat
{ {
get { return (Context as IGLContextInternal).GraphicsFormat; } get { return (Context as IGLContextInternal).GraphicsFormat; }
} }

View file

@ -98,23 +98,23 @@ namespace OpenTK
#region --- Contructors --- #region --- Contructors ---
public GameWindow() : this("OpenTK Game Window", 640, 480, null, GraphicsFormat.Default) { } public GameWindow() : this("OpenTK Game Window", 640, 480, null, GraphicsMode.Default) { }
public GameWindow(string title) : this(title, 640, 480, null, GraphicsFormat.Default) { } public GameWindow(string title) : this(title, 640, 480, null, GraphicsMode.Default) { }
public GameWindow(string title, int width, int height) public GameWindow(string title, int width, int height)
: this(title, width, height, null, GraphicsFormat.Default) { } : this(title, width, height, null, GraphicsMode.Default) { }
public GameWindow(string title, int width, int height, GraphicsFormat format) public GameWindow(string title, int width, int height, GraphicsMode format)
: this(title, width, height, null, format) { } : this(title, width, height, null, format) { }
public GameWindow(string title, DisplayResolution resolution) public GameWindow(string title, DisplayResolution resolution)
: this(title, resolution.Width, resolution.Height, resolution, GraphicsFormat.Default) { } : this(title, resolution.Width, resolution.Height, resolution, GraphicsMode.Default) { }
public GameWindow(string title, DisplayResolution resolution, GraphicsFormat format) public GameWindow(string title, DisplayResolution resolution, GraphicsMode format)
: this(title, resolution.Width, resolution.Height, resolution, format) { } : this(title, resolution.Width, resolution.Height, resolution, format) { }
GameWindow(string title, int width, int height, DisplayResolution resolution, GraphicsFormat format) GameWindow(string title, int width, int height, DisplayResolution resolution, GraphicsMode format)
{ {
if (Configuration.RunningOnWindows) if (Configuration.RunningOnWindows)
glWindow = new OpenTK.Platform.Windows.WinGLNative(); glWindow = new OpenTK.Platform.Windows.WinGLNative();

View file

@ -39,7 +39,7 @@ namespace OpenTK.Graphics
: this(mode.ToGraphicsFormat(), window) : this(mode.ToGraphicsFormat(), window)
{ } { }
public GraphicsContext(GraphicsFormat format, IWindowInfo window) public GraphicsContext(GraphicsMode format, IWindowInfo window)
{ {
//if (available_contexts.Count == 0) //if (available_contexts.Count == 0)
// available_contexts.Add(IntPtr.Zero, new WeakReference(null)); // available_contexts.Add(IntPtr.Zero, new WeakReference(null));
@ -247,7 +247,7 @@ namespace OpenTK.Graphics
/// <summary> /// <summary>
/// Gets the DisplayMode of the context. /// Gets the DisplayMode of the context.
/// </summary> /// </summary>
GraphicsFormat IGLContextInternal.GraphicsFormat GraphicsMode IGLContextInternal.GraphicsFormat
{ {
get { return (implementation as IGLContextInternal).GraphicsFormat; } get { return (implementation as IGLContextInternal).GraphicsFormat; }
} }

View file

@ -13,7 +13,7 @@ using System.Text;
namespace OpenTK.Graphics namespace OpenTK.Graphics
{ {
/// <summary>Defines the format for graphics operations.</summary> /// <summary>Defines the format for graphics operations.</summary>
public class GraphicsFormat public class GraphicsMode
{ {
ColorDepth color_format, accumulator_format; ColorDepth color_format, accumulator_format;
int depth, stencil, buffers, samples; int depth, stencil, buffers, samples;
@ -26,7 +26,7 @@ namespace OpenTK.Graphics
/// <internal /> /// <internal />
/// <summary>Constructs a new GraphicsFormat from the given GraphicsFormat.</summary> /// <summary>Constructs a new GraphicsFormat from the given GraphicsFormat.</summary>
/// <param name="mode"></param> /// <param name="mode"></param>
internal GraphicsFormat(GraphicsFormat mode) internal GraphicsMode(GraphicsMode mode)
: this(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo) { } : this(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo) { }
#endregion #endregion
@ -34,7 +34,7 @@ namespace OpenTK.Graphics
#region public GraphicsFormat() #region public GraphicsFormat()
/// <summary>Constructs a new GraphicsFormat with sensible default parameters.</summary> /// <summary>Constructs a new GraphicsFormat with sensible default parameters.</summary>
public GraphicsFormat() public GraphicsMode()
: this(Default) : this(Default)
{ } { }
@ -44,7 +44,7 @@ namespace OpenTK.Graphics
/// <summary>Constructs a new GraphicsFormat with the specified parameters.</summary> /// <summary>Constructs a new GraphicsFormat with the specified parameters.</summary>
/// <param name="color">The ColorFormat of the color buffer.</param> /// <param name="color">The ColorFormat of the color buffer.</param>
public GraphicsFormat(ColorDepth color) public GraphicsMode(ColorDepth color)
: this(color, Default.Depth, Default.Stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo) : this(color, Default.Depth, Default.Stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo)
{ } { }
@ -55,7 +55,7 @@ namespace OpenTK.Graphics
/// <summary>Constructs a new GraphicsFormat with the specified parameters.</summary> /// <summary>Constructs a new GraphicsFormat with the specified parameters.</summary>
/// <param name="color">The ColorFormat of the color buffer.</param> /// <param name="color">The ColorFormat of the color buffer.</param>
/// <param name="depth">The number of bits in the depth buffer.</param> /// <param name="depth">The number of bits in the depth buffer.</param>
public GraphicsFormat(ColorDepth color, int depth) public GraphicsMode(ColorDepth color, int depth)
: this(color, depth, Default.Stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo) : this(color, depth, Default.Stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo)
{ } { }
@ -67,7 +67,7 @@ namespace OpenTK.Graphics
/// <param name="color">The ColorFormat of the color buffer.</param> /// <param name="color">The ColorFormat of the color buffer.</param>
/// <param name="depth">The number of bits in the depth buffer.</param> /// <param name="depth">The number of bits in the depth buffer.</param>
/// <param name="stencil">The number of bits in the stencil buffer.</param> /// <param name="stencil">The number of bits in the stencil buffer.</param>
public GraphicsFormat(ColorDepth color, int depth, int stencil) public GraphicsMode(ColorDepth color, int depth, int stencil)
: this(color, depth, stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo) : this(color, depth, stencil, Default.Samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo)
{ } { }
@ -80,7 +80,7 @@ namespace OpenTK.Graphics
/// <param name="depth">The number of bits in the depth buffer.</param> /// <param name="depth">The number of bits in the depth buffer.</param>
/// <param name="stencil">The number of bits in the stencil buffer.</param> /// <param name="stencil">The number of bits in the stencil buffer.</param>
/// <param name="samples">The number of samples for FSAA.</param> /// <param name="samples">The number of samples for FSAA.</param>
public GraphicsFormat(ColorDepth color, int depth, int stencil, int samples) public GraphicsMode(ColorDepth color, int depth, int stencil, int samples)
: this(color, depth, stencil, samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo) : this(color, depth, stencil, samples, Default.AccumulatorFormat, Default.Buffers, Default.Stereo)
{ } { }
@ -94,7 +94,7 @@ namespace OpenTK.Graphics
/// <param name="stencil">The number of bits in the stencil buffer.</param> /// <param name="stencil">The number of bits in the stencil buffer.</param>
/// <param name="samples">The number of samples for FSAA.</param> /// <param name="samples">The number of samples for FSAA.</param>
/// <param name="accum">The ColorFormat of the accumilliary buffer.</param> /// <param name="accum">The ColorFormat of the accumilliary buffer.</param>
public GraphicsFormat(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum) public GraphicsMode(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum)
: this(color, depth, stencil, samples, accum, Default.Buffers, Default.Stereo) : this(color, depth, stencil, samples, accum, Default.Buffers, Default.Stereo)
{ } { }
@ -109,7 +109,7 @@ namespace OpenTK.Graphics
/// <param name="samples">The number of samples for FSAA.</param> /// <param name="samples">The number of samples for FSAA.</param>
/// <param name="accum">The ColorFormat of the accumilliary buffer.</param> /// <param name="accum">The ColorFormat of the accumilliary buffer.</param>
/// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param> /// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param>
public GraphicsFormat(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum, int buffers) public GraphicsMode(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum, int buffers)
: this(color, depth, stencil, samples, accum, buffers, Default.Stereo) : this(color, depth, stencil, samples, accum, buffers, Default.Stereo)
{ } { }
@ -125,7 +125,7 @@ namespace OpenTK.Graphics
/// <param name="accum">The ColorFormat of the accumilliary buffer.</param> /// <param name="accum">The ColorFormat of the accumilliary buffer.</param>
/// <param name="stereo">Set to true for a GraphicsFormat with stereographic capabilities.</param> /// <param name="stereo">Set to true for a GraphicsFormat with stereographic capabilities.</param>
/// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param> /// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param>
public GraphicsFormat(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum, int buffers, bool stereo) public GraphicsMode(ColorDepth color, int depth, int stencil, int samples, ColorDepth accum, int buffers, bool stereo)
{ {
if (depth < 0) throw new ArgumentOutOfRangeException("depth", "Must be greater than, or equal to zero."); if (depth < 0) throw new ArgumentOutOfRangeException("depth", "Must be greater than, or equal to zero.");
if (stencil < 0) throw new ArgumentOutOfRangeException("stencil", "Must be greater than, or equal to zero."); if (stencil < 0) throw new ArgumentOutOfRangeException("stencil", "Must be greater than, or equal to zero.");
@ -239,9 +239,9 @@ namespace OpenTK.Graphics
#region public static GraphicsFormat Default #region public static GraphicsFormat Default
/// <summary>Returns an OpenTK.GraphicsFormat compatible with the underlying platform.</summary> /// <summary>Returns an OpenTK.GraphicsFormat compatible with the underlying platform.</summary>
public static GraphicsFormat Default public static GraphicsMode Default
{ {
get { return new GraphicsFormat(DisplayDevice.PrimaryDisplay.BitsPerPixel, 16, 0, 0, 0, 2, false); } get { return new GraphicsMode(DisplayDevice.PrimaryDisplay.BitsPerPixel, 16, 0, 0, 0, 2, false); }
} }
#endregion #endregion

View file

@ -79,7 +79,7 @@ namespace OpenTK.Graphics
IWindowInfo Info { get; } IWindowInfo Info { get; }
/// <summary>Gets the GraphicsFormat of the context.</summary> /// <summary>Gets the GraphicsFormat of the context.</summary>
GraphicsFormat GraphicsFormat { get; } GraphicsMode GraphicsFormat { get; }
///// <summary> ///// <summary>
///// Gets a System.IntPtr containing the handle to the OpenGL context which is current in the ///// Gets a System.IntPtr containing the handle to the OpenGL context which is current in the

View file

@ -17,19 +17,19 @@ namespace OpenTK.Platform
/// </summary> /// </summary>
internal sealed class DummyGLContext : IGraphicsContext internal sealed class DummyGLContext : IGraphicsContext
{ {
GraphicsFormat format; GraphicsMode format;
bool vsync; bool vsync;
#region --- Constructors --- #region --- Constructors ---
public DummyGLContext(GraphicsFormat format) { this.format = format; } public DummyGLContext(GraphicsMode format) { this.format = format; }
#endregion #endregion
#region --- IGraphicsContext Members --- #region --- IGraphicsContext Members ---
public IntPtr Context { get { return IntPtr.Zero; } } public IntPtr Context { get { return IntPtr.Zero; } }
public GraphicsFormat GraphicsFormat { get { return format; } } public GraphicsMode GraphicsFormat { get { return format; } }
public void CreateContext() { } public void CreateContext() { }
public void CreateContext(bool direct) { } public void CreateContext(bool direct) { }

View file

@ -32,7 +32,7 @@ namespace OpenTK.Platform.Windows
const string opengl32Name = "OPENGL32.DLL"; const string opengl32Name = "OPENGL32.DLL";
WinWindowInfo windowInfo = new WinWindowInfo(); WinWindowInfo windowInfo = new WinWindowInfo();
GraphicsFormat format; GraphicsMode format;
//DisplayMode mode = null; //DisplayMode mode = null;
bool vsync_supported; bool vsync_supported;
@ -58,7 +58,7 @@ namespace OpenTK.Platform.Windows
} }
} }
GraphicsFormat SelectFormat(GraphicsFormat format) GraphicsMode SelectFormat(GraphicsMode format)
{ {
using (WinGLNative native = new WinGLNative(16, 16)) using (WinGLNative native = new WinGLNative(16, 16))
//using (WinGLContext context = new WinGLContext(format, native.WindowInfo, null)) //using (WinGLContext context = new WinGLContext(format, native.WindowInfo, null))
@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
} }
} }
public WinGLContext(GraphicsFormat format, IWindowInfo window, IGraphicsContext sharedContext) public WinGLContext(GraphicsMode format, IWindowInfo window, IGraphicsContext sharedContext)
{ {
//format = this.SelectFormat(format); //format = this.SelectFormat(format);
@ -222,7 +222,7 @@ namespace OpenTK.Platform.Windows
#region GraphicsFormat IGLContextInternal.GraphicsFormat #region GraphicsFormat IGLContextInternal.GraphicsFormat
GraphicsFormat IGLContextInternal.GraphicsFormat GraphicsMode IGLContextInternal.GraphicsFormat
{ {
get { return format; } get { return format; }
} }
@ -271,7 +271,7 @@ namespace OpenTK.Platform.Windows
#region GraphicsFormat SetGraphicsFormatPFD(GraphicsFormat format) #region GraphicsFormat SetGraphicsFormatPFD(GraphicsFormat format)
GraphicsFormat SetGraphicsFormatPFD(GraphicsFormat format) GraphicsMode SetGraphicsFormatPFD(GraphicsMode format)
{ {
deviceContext = Functions.GetDC(this.windowInfo.Handle); deviceContext = Functions.GetDC(this.windowInfo.Handle);
Debug.WriteLine(String.Format("Device context: {0}", deviceContext)); Debug.WriteLine(String.Format("Device context: {0}", deviceContext));
@ -317,7 +317,7 @@ namespace OpenTK.Platform.Windows
pixelFormat.Size = API.PixelFormatDescriptorSize; pixelFormat.Size = API.PixelFormatDescriptorSize;
pixelFormat.Version = API.PixelFormatDescriptorVersion; pixelFormat.Version = API.PixelFormatDescriptorVersion;
Functions.DescribePixelFormat(deviceContext, pixel, API.PixelFormatDescriptorSize, ref pfd); Functions.DescribePixelFormat(deviceContext, pixel, API.PixelFormatDescriptorSize, ref pfd);
GraphicsFormat fmt = new GraphicsFormat( GraphicsMode fmt = new GraphicsMode(
new ColorDepth(pfd.RedBits, pfd.GreenBits, pfd.BlueBits, pfd.AlphaBits), new ColorDepth(pfd.RedBits, pfd.GreenBits, pfd.BlueBits, pfd.AlphaBits),
pfd.DepthBits, pfd.DepthBits,
pfd.StencilBits, pfd.StencilBits,
@ -338,7 +338,7 @@ namespace OpenTK.Platform.Windows
#region GraphicsFormat SetGraphicsFormatARB(GraphicsFormat format) #region GraphicsFormat SetGraphicsFormatARB(GraphicsFormat format)
GraphicsFormat SetGraphicsFormatARB(GraphicsFormat format) GraphicsMode SetGraphicsFormatARB(GraphicsMode format)
{ {
return null; return null;
} }

View file

@ -24,7 +24,7 @@ namespace OpenTK.Platform.X11
IntPtr context; IntPtr context;
DisplayMode mode; DisplayMode mode;
X11WindowInfo windowInfo = new X11WindowInfo(); X11WindowInfo windowInfo = new X11WindowInfo();
GraphicsFormat format; GraphicsMode format;
IntPtr visual; IntPtr visual;
bool vsync_supported; bool vsync_supported;
int vsync_interval; int vsync_interval;
@ -306,7 +306,7 @@ namespace OpenTK.Platform.X11
#region public DisplayMode Mode #region public DisplayMode Mode
GraphicsFormat IGLContextInternal.GraphicsFormat GraphicsMode IGLContextInternal.GraphicsFormat
{ {
get { return format; } get { return format; }
} }