Removed obsolete GetDisplayModes() function.

This commit is contained in:
the_fiddler 2008-04-04 21:08:09 +00:00
parent 224f917a49
commit 84f117b3d3
4 changed files with 37 additions and 66 deletions

View file

@ -83,10 +83,10 @@ namespace OpenTK.Graphics
implementation = new OpenTK.Platform.X11.X11GLContext(mode, window, shareContext, DirectRendering);
else
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
lock (context_lock)
lock (context_lock)
{
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
}
//(implementation as IGraphicsContextInternal).LoadAll();
}
@ -121,8 +121,8 @@ namespace OpenTK.Graphics
public static GraphicsContext CurrentContext
{
get
{
lock (context_lock)
{
lock (context_lock)
{
if (available_contexts.Count > 0)
{
@ -130,7 +130,7 @@ namespace OpenTK.Graphics
if (handle.Handle != IntPtr.Zero)
return (GraphicsContext)available_contexts[handle].Target;
}
return null;
return null;
}
}
//set
@ -205,10 +205,10 @@ namespace OpenTK.Graphics
void CreateContext(bool direct, IGraphicsContext source)
{
this.Destroy += ContextDestroyed;
lock (context_lock)
{
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
{
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
}
//OpenTK.Graphics.OpenGL.GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
@ -333,15 +333,6 @@ namespace OpenTK.Graphics
dispose_queue.Clear();
}
/// <summary>
/// Returns the display modes supported by the current opengl context.
/// </summary>
/// <returns>An IEnumerable containing all supported display modes.</returns>
IEnumerable<DisplayMode> IGraphicsContextInternal.GetDisplayModes()
{
return (implementation as IGraphicsContextInternal).GetDisplayModes();
}
/// <summary>
/// Gets the address of an OpenGL extension function.
/// </summary>
@ -372,12 +363,12 @@ namespace OpenTK.Graphics
void Dispose(bool manual)
{
if (!disposed)
{
Debug.WriteLine("Disposing context {0}.", (this as IGraphicsContextInternal).Context.ToString());
lock (context_lock)
{
Debug.WriteLine("Disposing context {0}.", (this as IGraphicsContextInternal).Context.ToString());
lock (context_lock)
{
available_contexts.Remove((this as IGraphicsContextInternal).Context);
}
available_contexts.Remove((this as IGraphicsContextInternal).Context);
}
if (manual)
{
@ -409,4 +400,4 @@ namespace OpenTK.Graphics
}
#endregion
}
}

View file

@ -105,12 +105,6 @@ namespace OpenTK.Graphics
/// </summary>
void DisposeResources();
/// <summary>
/// Returns the display modes supported by the current opengl context.
/// </summary>
/// <returns>An IEnumerable containing all supported display modes.</returns>
IEnumerable<DisplayMode> GetDisplayModes();
/// <summary>
/// Gets the address of an OpenGL extension function.
/// </summary>

View file

@ -253,15 +253,6 @@ namespace OpenTK.Platform.Windows
#endregion
#region public DisplayMode[] GetDisplayModes()
public IEnumerable<DisplayMode> GetDisplayModes()
{
throw new NotSupportedException("See OpenTK.Graphics.DisplayDevice.AvailableModes instead.");
}
#endregion
#region void IGLContextInternal.RegisterForDisposal(IDisposable resource)
void IGraphicsContextInternal.RegisterForDisposal(IDisposable resource)

View file

@ -63,17 +63,17 @@ namespace OpenTK.Platform.X11
XVisualInfo info = new XVisualInfo();
info.visualid = (IntPtr)mode.Index;
info.screen = currentWindow.Screen;
int items;
lock (API.Lock)
int items;
lock (API.Lock)
{
IntPtr vs = Functions.XGetVisualInfo(currentWindow.Display, XVisualInfoMask.ID | XVisualInfoMask.Screen, ref info, out items);
if (items == 0)
throw new GraphicsModeException(String.Format("Invalid GraphicsMode specified ({0}).", mode));
info = (XVisualInfo)Marshal.PtrToStructure(vs, typeof(XVisualInfo));
Functions.XFree(vs);
}
Functions.XFree(vs);
}
return info;
}
@ -93,9 +93,9 @@ namespace OpenTK.Platform.X11
Debug.Write(direct ? "direct, " : "indirect, ");
Debug.Write(shareHandle.Handle == IntPtr.Zero ? "not shared... " :
String.Format("shared with ({0})... ", shareHandle));
lock (API.Lock)
{
lock (API.Lock)
{
XVisualInfo info = window.VisualInfo; // Cannot pass a Property by reference.
context = Glx.CreateContext(window.Display, ref info, shareHandle.Handle, direct);
@ -115,7 +115,7 @@ namespace OpenTK.Platform.X11
Debug.Print("done! (id: {0})", context);
return;
}
}
}
Debug.Print("failed.");
throw new GraphicsModeException("Failed to create OpenGL context. Glx.CreateContext call returned 0.");
@ -202,10 +202,10 @@ namespace OpenTK.Platform.X11
set
{
if (vsync_supported)
{
{
int error_code = Glx.Sgi.SwapInterval(value ? 1 : 0);
if (error_code != 0)
throw new GraphicsException(String.Format("Could not set vsync, error code: {0}", error_code));
throw new GraphicsException(String.Format("Could not set vsync, error code: {0}", error_code));
vsync_interval = value ? 1 : 0;
}
}
@ -234,11 +234,6 @@ namespace OpenTK.Platform.X11
throw new NotSupportedException("Use OpenTK.GraphicsContext instead.");
}
public IEnumerable<DisplayMode> GetDisplayModes()
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
#region --- IGLContextInternal Members ---
@ -294,7 +289,7 @@ namespace OpenTK.Platform.X11
#region static ContextHandle GetCurrentContext()
static ContextHandle GetCurrentContext()
{
{
return (ContextHandle)Glx.GetCurrentContext();
}
@ -313,20 +308,20 @@ namespace OpenTK.Platform.X11
private void Dispose(bool manuallyCalled)
{
if (!disposed)
{
{
// Clean unmanaged resources:
try
{
try
{
Functions.XLockDisplay(currentWindow.Display);
Glx.MakeCurrent(currentWindow.Display, IntPtr.Zero, IntPtr.Zero);
Glx.DestroyContext(currentWindow.Display, context);
//Functions.XFree(visual);
}
finally
{
Functions.XUnlockDisplay(currentWindow.Display);
Glx.DestroyContext(currentWindow.Display, context);
//Functions.XFree(visual);
}
finally
{
Functions.XUnlockDisplay(currentWindow.Display);
}
if (manuallyCalled)
{
}