diff --git a/Source/Bind/Settings.cs b/Source/Bind/Settings.cs index 204c74bc..4e857fd3 100644 --- a/Source/Bind/Settings.cs +++ b/Source/Bind/Settings.cs @@ -27,7 +27,7 @@ namespace Bind // TODO: This code is too fragile. // Old enums code: - public static string normalEnumsClassOverride; + public static string normalEnumsClassOverride = null; public static string NestedEnumsClass = "Enums"; public static string NormalEnumsClass { diff --git a/Source/Build/Build.cs b/Source/Build/Build.cs index 86813b6f..685c5fb2 100644 --- a/Source/Build/Build.cs +++ b/Source/Build/Build.cs @@ -386,7 +386,7 @@ namespace OpenTK.Build //DirectoryInfo dir; //FileInfo[] files; //DirectoryInfo[] dirs; - string tmppath; + //string tmppath; //determine if the destination directory exists, if not create it if (!Directory.Exists(destdir)) diff --git a/Source/Examples/ExampleLauncher.cs b/Source/Examples/ExampleLauncher.cs index ce4ad60d..cb59324b 100644 --- a/Source/Examples/ExampleLauncher.cs +++ b/Source/Examples/ExampleLauncher.cs @@ -160,7 +160,7 @@ namespace Examples Debug.Print(expt.ToString()); #if DEBUG - throw; + //throw; #endif } catch (NullReferenceException expt) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 4f6ba579..6470cac1 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -64,7 +64,7 @@ namespace OpenTK double update_period, render_period; double target_update_period, target_render_period, target_render_period_doubled; // TODO: Implement these: - double update_time, render_time, event_time; + double update_time, render_time;//, event_time; //bool allow_sleep = true; // If true, GameWindow will call Timer.Sleep() if there is enough time. int width, height; VSyncMode vsync; diff --git a/Source/OpenTK/Input/MouseDevice.cs b/Source/OpenTK/Input/MouseDevice.cs index 4eba7b82..56749666 100644 --- a/Source/OpenTK/Input/MouseDevice.cs +++ b/Source/OpenTK/Input/MouseDevice.cs @@ -220,7 +220,7 @@ namespace OpenTK.Input #endregion } - //public delegate void MouseMoveEvent(MouseDevice sender, MouseMoveData key); + public delegate void MouseMoveEvent(MouseDevice sender); public delegate void MouseButtonDownEvent(MouseDevice sender, MouseButton button); public delegate void MouseButtonUpEvent(MouseDevice sender, MouseButton button); @@ -247,65 +247,4 @@ namespace OpenTK.Input } #endregion - - #region internal class MouseMoveData - - /// - /// Not used yet. - /// - internal class MouseMoveData - { - private int x; - private int y; - private int deltaX; - private int deltaY; - private int wheel, deltaWheel; - - /// - /// Gets the absolute X position of the mouse in screen pixel coordinates. - /// - public int X - { - get { return x; } - internal set { x = value; } - } - - /// - /// Gets the absolute Y position of the mouse in screen pixel coordinates. - /// - public int Y - { - get { return y; } - internal set { y = value; } - } - - /// - /// Gets the relative movement of the mouse in the X direction, in pixels. - /// - public int DeltaX - { - get { return deltaX; } - internal set { deltaX = value; } - } - - /// - /// Gets the relative movement of the mouse in the Y direction, in pixels. - /// - public int DeltaY - { - get { return deltaY; } - internal set { deltaY = value; } - } - - /// - /// Gets data relevant to the mouse wheel. - /// - //public MouseWheel Wheel - //{ - // get { return wheel; } - // internal set { wheel = value; } - //} - } - - #endregion } diff --git a/Source/OpenTK/Math/Vector2d.cs b/Source/OpenTK/Math/Vector2d.cs index 53275c56..593740dd 100644 --- a/Source/OpenTK/Math/Vector2d.cs +++ b/Source/OpenTK/Math/Vector2d.cs @@ -63,21 +63,21 @@ namespace OpenTK.Math /// Converts the vector into left double-precision floating point number pointer. /// The vector being converted. /// A double-precision floating point number pointer to the vector coordinates. - unsafe public static explicit operator double*(Vector2d vector) - { - return &vector.X; - } + //unsafe public static explicit operator double*(Vector2d vector) + //{ + // return &vector.X; + //} /// Converts the vector into an IntPtr. /// The vector being converted. /// An IntPtr to the vector coordinates. - public static explicit operator IntPtr(Vector2d vector) - { - unsafe - { - return (IntPtr)(&vector.X); - } - } + //public static explicit operator IntPtr(Vector2d vector) + //{ + // unsafe + // { + // return (IntPtr)(&vector.X); + // } + //} #endregion @@ -119,6 +119,7 @@ namespace OpenTK.Math /// Indicates whether the current vector is equal to another vector. /// An vector to compare with this vector. /// true if the current vector is equal to the vector parameter; otherwise, false. + [CLSCompliant(false)] public bool Equals(Vector2d vector) { return diff --git a/Source/OpenTK/OpenAL/AlFunctions.cs b/Source/OpenTK/OpenAL/AlFunctions.cs index 91b660c8..b466381c 100644 --- a/Source/OpenTK/OpenAL/AlFunctions.cs +++ b/Source/OpenTK/OpenAL/AlFunctions.cs @@ -391,7 +391,7 @@ namespace OpenTK.OpenAL #region Create Source objects - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGenSources",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport(AL.Lib,EntryPoint = "alGenSources",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] unsafe private static extern void GenSourcesPrivate( int n,[Out] uint* sources ); // AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* Sources ); diff --git a/Source/OpenTK/OpenAL/EfxFunctions.cs b/Source/OpenTK/OpenAL/EfxFunctions.cs index 014d637b..46571e92 100644 --- a/Source/OpenTK/OpenAL/EfxFunctions.cs +++ b/Source/OpenTK/OpenAL/EfxFunctions.cs @@ -21,7 +21,7 @@ namespace OpenTK.OpenAL #region alGenEffects // typedef void (__cdecl *LPALGENEFFECTS)( ALsizei n, ALuint* effects ); - [CLSCompliant(false)] + //[CLSCompliant(false)] unsafe private delegate void Delegate_alGenEffects( int n,[Out] uint* effects ); //[CLSCompliant(false)] @@ -63,7 +63,7 @@ namespace OpenTK.OpenAL #region alDeleteEffects // typedef void (__cdecl *LPALDELETEEFFECTS)( ALsizei n, ALuint* effects ); - [CLSCompliant(false)] + //[CLSCompliant(false)] unsafe private delegate void Delegate_alDeleteEffects( int n,[In] uint* effects ); //[CLSCompliant(false)] @@ -173,11 +173,11 @@ namespace OpenTK.OpenAL #region alEffectfv - [CLSCompliant(false)] + //[CLSCompliant(false)] unsafe private delegate void Delegate_alEffectfv(uint eid, Enums.EfxEffect3f param, [In] float* values); // typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values ); - [CLSCompliant(false)] + //[CLSCompliant(false)] private Delegate_alEffectfv Imported_alEffectfv; [CLSCompliant(false)] @@ -665,10 +665,10 @@ namespace OpenTK.OpenAL #region alGetAuxiliaryEffectSlotf // typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum pname, ALfloat* value ); - [CLSCompliant(false)] + //[CLSCompliant(false)] unsafe private delegate void Delegate_alGetAuxiliaryEffectSlotf( uint asid,Enums.EfxAuxiliaryf pname,[Out] float* value ); - [CLSCompliant(false)] + //[CLSCompliant(false)] private Delegate_alGetAuxiliaryEffectSlotf Imported_alGetAuxiliaryEffectSlotf; /// This function is used to retrieve floating properties on Auxiliary Effect Slot objects. diff --git a/Source/OpenTK/OpenAL/EfxPresets.cs b/Source/OpenTK/OpenAL/EfxPresets.cs index dfd652c3..d2fbc081 100644 --- a/Source/OpenTK/OpenAL/EfxPresets.cs +++ b/Source/OpenTK/OpenAL/EfxPresets.cs @@ -16,21 +16,23 @@ namespace OpenTK.OpenAL public partial class EfxExtension { + // TODO: CLS compliance. + [CLSCompliant(false)] public struct EaxReverb { - public uint _Environment; - public float _EnvironmentSize; - public float _EnvironmentDiffusion; - public int _Room; - public int _RoomHF; - public int _RoomLF; + public uint Environment; // TODO: EAX-EFX conversion + public float EnvironmentSize; // TODO: EAX-EFX conversion + public float EnvironmentDiffusion; // TODO: EAX-EFX conversion + public int Room; // TODO: EAX-EFX conversion + public int RoomHF; // TODO: EAX-EFX conversion + public int RoomLF; // TODO: EAX-EFX conversion public float DecayTime; public float DecayHFRatio; public float DecayLFRatio; - public int _Reflections; + public int Reflections; // TODO: EAX-EFX conversion public float ReflectionsDelay; public Vector3 ReflectionsPan; - public int _Reverb; + public int Reverb; // TODO: EAX-EFX conversion public float ReverbDelay; public Vector3 ReverbPan; public float EchoTime; @@ -41,7 +43,7 @@ namespace OpenTK.OpenAL public float HFReference; public float LFReference; public float RoomRolloffFactor; - public uint _Flags; + public uint Flags; // TODO: EAX-EFX conversion public EaxReverb( uint environment, float environmentSize, @@ -72,19 +74,19 @@ namespace OpenTK.OpenAL float roomRolloffFactor, uint flags ) { - _Environment = environment; - _EnvironmentSize = environmentSize; - _EnvironmentDiffusion = environmentDiffusion; - _Room = room; - _RoomHF = roomHF; - _RoomLF = roomLF; + Environment = environment; + EnvironmentSize = environmentSize; + EnvironmentDiffusion = environmentDiffusion; + Room = room; + RoomHF = roomHF; + RoomLF = roomLF; DecayTime = decayTime; DecayHFRatio = decayHFRatio; DecayLFRatio = decayLFRatio; - _Reflections = reflections; + Reflections = reflections; ReflectionsDelay = reflectionsDelay; ReflectionsPan = new Vector3(reflectionsPanX,reflectionsPanY,reflectionsPanZ); - _Reverb = reverb; + Reverb = reverb; ReverbDelay = reverbDelay; ReverbPan = new Vector3(reverbPanX,reverbPanY,reverbPanZ); EchoTime = echoTime; @@ -95,11 +97,13 @@ namespace OpenTK.OpenAL HFReference = hfReference; LFReference = lfReference; RoomRolloffFactor = roomRolloffFactor; - _Flags = flags; + Flags = flags; } } + // TODO: CLS compliance. + [CLSCompliant(false)] public static void GetEaxFromEfxEax( ref EaxReverb input,out EfxEaxReverb output ) { output.AirAbsorptionGainHF = 0.995f; // input.AirAbsorptionHF * somegain? @@ -200,8 +204,9 @@ namespace OpenTK.OpenAL void ConvertOcclusionParameters(EAXOCCLUSIONPROPERTIES *pOcProp, EFXLOWPASSFILTER *pDirectLowPassFilter, EFXLOWPASSFILTER *pSendLowPassFilter); */ - + // TODO: CLS compliance. ///EAX Reverb Presets in legacy format - use ConvertReverbParameters() to convert to EFX EAX Reverb Presets for use with the OpenAL Effects Extension. + [CLSCompliant(false)] public static class ReverbPresets { // CASTLE PRESETS diff --git a/Source/OpenTK/Platform/DummyGLContext.cs b/Source/OpenTK/Platform/DummyGLContext.cs index 73e2e6de..7a2051ba 100644 --- a/Source/OpenTK/Platform/DummyGLContext.cs +++ b/Source/OpenTK/Platform/DummyGLContext.cs @@ -42,6 +42,7 @@ namespace OpenTK.Platform public IntPtr GetCurrentContext() { return IntPtr.Zero; } public event DestroyEvent Destroy; + void OnDestroy() { if (Destroy != null) Destroy(this, EventArgs.Empty); } public void RegisterForDisposal(IDisposable resource) { diff --git a/Source/OpenTK/Platform/Windows/WglHelper.cs b/Source/OpenTK/Platform/Windows/WglHelper.cs index fbd55591..bf55aba1 100644 --- a/Source/OpenTK/Platform/Windows/WglHelper.cs +++ b/Source/OpenTK/Platform/Windows/WglHelper.cs @@ -186,6 +186,7 @@ namespace OpenTK.Platform.Windows #endif #endregion + /// Contains ARB extensions for WGL. public static partial class Arb { private static string[] extensions; @@ -211,5 +212,32 @@ namespace OpenTK.Platform.Windows return false; } } + + /// Contains EXT extensions for WGL. + public static partial class Ext + { + private static string[] extensions; + /// + /// Checks if a Wgl extension is supported by the given context. + /// + /// The device context. + /// The extension to check. + /// True if the extension is supported by the given context, false otherwise + public static bool SupportsExtension(IntPtr deviceContext, string ext) + { + if (Wgl.Delegates.wglGetExtensionsStringEXT != null) + { + if (extensions == null || reload_ext_extension_strings) + { + extensions = Wgl.Ext.GetExtensionsString().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + Array.Sort(extensions); + reload_ext_extension_strings = false; + } + + return Array.BinarySearch(extensions, ext) != -1; + } + return false; + } + } } } diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index 462a9365..4f3e1c5e 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -254,16 +254,23 @@ namespace OpenTK.Platform.Windows #endregion + #region void IGLContextInternal.RegisterForDisposal(IDisposable resource) + void IGLContextInternal.RegisterForDisposal(IDisposable resource) { - throw new NotImplementedException("Use the general GLContext class instead."); + throw new NotSupportedException("Use OpenTK.GLContext instead."); } + #endregion + + #region void IGLContextInternal.DisposeResources() + void IGLContextInternal.DisposeResources() { - throw new NotImplementedException("Use the general GLContext class instead."); + throw new NotSupportedException("Use OpenTK.GLContext instead."); } + #endregion #endregion diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index 4ebf9d25..fe658074 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -308,6 +308,16 @@ namespace OpenTK.Platform.X11 #endregion + #region --- Public Methods --- + + void OnDestroy() + { + if (Destroy != null) + Destroy(this, EventArgs.Empty); + } + + #endregion + #region --- IDisposable Members --- public void Dispose() diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index 3b38f0f4..c18a7afd 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -400,7 +400,7 @@ namespace OpenTK.Platform.X11 // Register for window destroy notification IntPtr wm_destroy_atom = Functions.XInternAtom(window.Display, "WM_DELETE_WINDOW", true); - XWMHints hint = new XWMHints(); + //XWMHints hint = new XWMHints(); Functions.XSetWMProtocols(window.Display, window.Handle, new IntPtr[] { wm_destroy_atom }, 1); Top = Left = 0;