Commit graph

1219 commits

Author SHA1 Message Date
the_fiddler
1cd2b8d076 Use SHOW command instead of SHOWNORMAL when making a window visible, since SHOWNORMAL will un-maximize a fullscreen or maximized window.
Do not force an invisible window to become visible when modifying its state or borders.
2009-11-07 10:44:31 +00:00
the_fiddler
dafcfd6f38 Always set the DisplayDevice.Bounds to a correct value. Fixes issue [#1339]: "DisplayDevice.Bounds not set". 2009-11-07 10:42:25 +00:00
the_fiddler
38a8efb649 Do not check for an X server if we detect Mac OS X. Should solve issue [#1338]: "Running apps in Mac OSX start a application called X11". 2009-11-07 10:10:53 +00:00
the_fiddler
2e418e5b6b Update the context when the native window is resized. 2009-11-06 21:56:35 +00:00
the_fiddler
ab198f15e7 Correctly set the primary device in the DisplayDevice constructor. 2009-11-06 18:34:53 +00:00
the_fiddler
70eba0eb20 MacOS can have an X server installed. Modified the code so that it prefers the native Carbon/Quartz platform driver over X in this case. 2009-11-06 17:58:35 +00:00
the_fiddler
7c82f66942 Fixed spelling of hertz and fps. Fixes issue [#1333]: "Spelling of SI units in documentation and captions". Patch by iRBiS. 2009-11-06 16:46:28 +00:00
the_fiddler
62fee03192 * Rectangle.cs: Fixed ToString formatting code. 2009-11-06 10:04:32 +00:00
the_fiddler
8733dd7c2f * Platform/Windows/WinDisplayDevice.cs:
* Platform/MacOS/QuartzDisplayDeviceDriver.cs: Updated to use the new
  DisplayDevice constructors.

* Platform/X11/X11XrandrDisplayDevice.cs: Query Xinerama for the exact
  bounds of each display device, if available.
Use global X lock to protect from multithreaded access.
2009-11-06 09:50:50 +00:00
the_fiddler
2af357c106 * DisplayDevice.cs: Made DisplayDevice properties settable
internally (simplifies device detection code).
Bounds property is now independent of the default resolution.

* DisplayResolution.cs: Obsoleted the Bounds property, as this becomes
  invalid as soon as the resolution of any display device is changed.
2009-11-06 09:49:06 +00:00
the_fiddler
39b4e329fd * X11GLNative.cs: Convert from ASCII to the default encoding before generating KeyPress events (allows support for simple scripts that do not use composition.) 2009-11-05 12:12:29 +00:00
the_fiddler
3e1ce4dfa5 * X11GLNative.cs: Implemented KeyPress event (no support for input
methods yet).

* Functions.cs: Added XLookupString and XRefreshKeyboardMapping
  methods for simple ANSI text input.
2009-11-05 11:49:24 +00:00
the_fiddler
ada915fed0 Added missing TitleChanged event. 2009-11-04 20:49:38 +00:00
the_fiddler
3fd2b4b30b Removed unused code. 2009-11-04 20:48:35 +00:00
the_fiddler
c09c21dc64 Cleaned up a large number of documentation issues. 2009-11-04 20:48:02 +00:00
the_fiddler
40235d84ca Added helper overloads for OpenTK.Point/Rectangle structures. 2009-11-04 19:24:21 +00:00
the_fiddler
6770e171ed Enabled System.Drawing.Point/Size/Rectangle replacements. 2009-11-04 19:10:32 +00:00
the_fiddler
b36e6c64d7 Refactored timer installation/removal into their own methods. 2009-11-04 18:35:32 +00:00
the_fiddler
bf8e2c695a Added simpler constructor overload for external GraphicsContexts. 2009-11-04 17:18:32 +00:00
the_fiddler
e3781e0b91 Don't forget to load all bindings when constructing an external context - this constructor was added for precisely this reason, after all. 2009-11-04 17:14:57 +00:00
the_fiddler
38576a20f2 Deprecated the LoadAll() method in favor of the new GraphicsContext constructors. 2009-11-04 17:03:59 +00:00
the_fiddler
9f4eca541f Support external EGL contexts. 2009-11-04 17:00:52 +00:00
the_fiddler
1f254a9f55 Added missing documentation to GraphicsContext constructor. 2009-11-04 17:00:34 +00:00
the_fiddler
5142354cda Renamed internal BindingsBase.LoadAll/Load methods to LoadEntryPoints/LoadEntryPoint, in order to avoid name clashes with the static GL.LoadAll() method.
Added GraphicsContext() constructor that takes an existing, valid OpenGL context. This can be used for interop with third-party toolkits which create the OpenGL context themselves.
2009-11-04 16:49:56 +00:00
the_fiddler
3ca21ed1b6 Initialize threads before calling any other X methods. 2009-11-04 10:04:16 +00:00
the_fiddler
9f96fe71c1 Removed unnecessary debugging messages from main loop. 2009-11-04 10:03:50 +00:00
the_fiddler
f5de2fc8d3 Added Toolkit.Init() method that can be used to configure the underlying platform correctly when using OpenTK along with other toolkits (e.g. OpenTK+GTK# on X, where GTK# does not initialize threads). 2009-11-04 09:46:45 +00:00
the_fiddler
765f54917e Default window style flags can be constants rather than static readonly fields.
Throw an exception if we fail to register the window class, the previous solution (check for "class already exists" error) was a workaround for a threading issue that has been solved.
Set the small icon when registering the class.
2009-11-04 09:21:41 +00:00
the_fiddler
15ab0d3ea7 Fixed ClassName and ModalLoopTimerId when constructing multiple WinGLNative windows in parallel.
WinGLNative windows are now correctly focused when clicked on the client area.
2009-11-03 23:42:06 +00:00
the_fiddler
544cf9d405 Serialize context construction to avoid threading issues with shared contexts. 2009-11-03 23:39:03 +00:00
the_fiddler
7e1ebfea6b Avoid static caching of extension strings and improve multithreading behavior - WGL extension checking is fast enough that caching is not very useful. 2009-11-03 23:36:37 +00:00
the_fiddler
bd3334dd2b Added SyncRoot object to BindingsBase that can be used to protect shared state in the various bindings. 2009-11-03 23:26:57 +00:00
the_fiddler
9b63078b11 Fixed race condition in GraphicsMode.Default. 2009-11-03 13:16:59 +00:00
the_fiddler
18109103e3 Use new string(sbyte*) instead of Marshal.PtrToStringAnsi to increase performance when calling GetString to retrieve the list of available extensions. 2009-11-03 12:59:25 +00:00
the_fiddler
eb92aa8223 Implemented Tranform(Vector, Quaternion) overloads. Fixes issue [#1028]: "[Math] Add vector transformation by quaternion". 2009-11-03 12:20:21 +00:00
the_fiddler
b5eb7fdb93 Deprecated Mult in favor of Multiply.
Modified operator * to use Multiply internally (reduces code duplication).
2009-11-03 12:11:51 +00:00
the_fiddler
eeda1bf866 Fixed Vector3.Transform signature to return a Vector3, not a Vector4. It was previously impossible to transform a Vector3 structure without intermediate conversions to Vector4. 2009-11-03 11:45:20 +00:00
the_fiddler
4d3e84701c Modified Transform(ref Vector4, ref Matrix4, out Vector4) overload to work correctly when the ref and out parameters point to the same Vector4.
Modified Transform(Vector4, Matrix4): Vector4 to call the reference overload internally. Faster and reduces code duplication.
2009-11-03 11:41:36 +00:00
the_fiddler
d757b00e0a Added missing TextureBuffer token to BufferTarget and TextureTarget enums (promoted from ARB_texture_buffer_object). Fixes issue [#1313]: "TextureBuffer target". 2009-11-03 10:33:24 +00:00
the_fiddler
dc572d7a6f Added type-safe parameters to FramebufferTexture (fixes issue [#1303]: "[GL] fix FramebufferTexture parameters"). 2009-11-03 10:22:50 +00:00
the_fiddler
74bae3e196 Use more aggressive xlib locking following the advice of the multithreaded X manpages (needs work). 2009-11-02 22:37:13 +00:00
the_fiddler
0bfb7897b0 Do not allow MakeCurrent() to change the display connection of the context. This would result in an X error and the change allows us to simplify shutdown/cleanup logic. 2009-11-02 20:50:16 +00:00
the_fiddler
1073c8ccac * Matrix4d.cs: M44 should be 1.0 to conform with GL.Ortho(). Fixes issue [#1307]: "GL.Ortho behaves other than combination of OpenTK.Matrix4d.CreateOrthographic and GL.MultMatrix". 2009-11-02 13:25:41 +00:00
the_fiddler
c8c652131e Added experimental Icon and IconConverter implementations from Mono.
Modified INativeWindow implementations to not qualify Icon class fully, so we can change the implementation between System.Drawing and OpenTK at will (using the EXPERIMENTAL #define).
2009-11-02 09:33:53 +00:00
the_fiddler
600f657b70 Improved interoperation with System.Drawing with new addition, subtraction and implicit conversion operators, as well as additional method overloads.
Only expose fields through public properties to allow for parameter validation.
2009-11-02 07:20:59 +00:00
the_fiddler
af2d77cdc5 Updated version numbers in preparation for release. 2009-11-01 23:07:38 +00:00
the_fiddler
041c491f19 Fixed an issue where "const unsigned [type] [pointer]" parameters where not parsed correctly. Solves issue [#1300]: "[OpenCL] Possible bug at CL.CreateProgramWithBinary". 2009-11-01 19:15:44 +00:00
the_fiddler
ff572e83b7 Added experimental OpenTK.Point/Size/Rectangle alternatives to System.Drawing, to make OpenTK usable without referencing System.Drawing (disabled by default, #define EXPERIMENTAL to test). Modified a number of using directives and namespace qualifiers to accommodate this change. 2009-11-01 12:44:38 +00:00
the_fiddler
4914574bd4 Document that these APIs are incomplete. 2009-11-01 12:40:25 +00:00
the_fiddler
792c4e3645 Merged es20 branch back into trunk. 2009-10-28 23:09:25 +00:00
the_fiddler
038e140e41 Return readonly IList<> instead of copying arrays of data. 2009-10-28 00:39:38 +00:00
the_fiddler
3d0a3dfb4e Implemented INativeWindow.MouseEnter/MouseLeave events on Win32 and X11. 2009-10-27 23:57:44 +00:00
the_fiddler
852fdc3662 Generate UpdateFrame events even if TargetUpdateFrequency is 0. According to the documentation, setting this value to 0 will result in unconstrained UpdateFrame frequency. Fixes issue [#1294]: "OnUpdateFrame function does not work with maximum update rate". 2009-10-27 22:23:11 +00:00
the_fiddler
721277d7f7 Do not qualify Stopwatch fully, to allow it to be overridden by Minimal.cs if necessary. 2009-10-24 10:35:49 +00:00
the_fiddler
f25e37c22a Provide dummy implementations for classes not available on the iPhone. 2009-10-24 10:35:15 +00:00
the_fiddler
0c25f266d3 Fixed x86-specific ABI assumption (do not pass structure directly when a pointer is expected). Patch by jonp. 2009-10-23 22:06:15 +00:00
the_fiddler
b8f8e46bab Added dllmap for OpenGL|ES on Mac OS X. 2009-10-23 20:11:40 +00:00
the_fiddler
ca540e2626 Debug.WriteLine(object, string) does not work as intended (the first parameter defines the category). Use Debug.Print instead. 2009-10-23 17:45:14 +00:00
the_fiddler
8527483c0b Fixed x86-specific ABI assumption (do not return structure directly when a pointer is expected). Patch by jonp. 2009-10-23 16:10:55 +00:00
the_fiddler
a7ccef9ae8 Set default class cursor to avoid invalid cursors when entering the window. 2009-10-21 20:08:04 +00:00
the_fiddler
f1fc4b5b4e Added LoadCursor method.
Added CursorName enum (only default arrow cursor is defined for now).
2009-10-21 20:07:32 +00:00
the_fiddler
f127ddf031 Use StringBuilder.Capacity to specify the available buffer size in OpenGL interop (StringBuilder.Length is invalid in this case).
Added workaround for Mono 1.9.1 issue, where StringBuilder return truncated results when used in interop. Doubling the StringBuilder capacity fixes this issue.
2009-10-21 17:26:07 +00:00
the_fiddler
895e416ca1 OnLoad/OnUnload should be protected, not public, to conform with the class library design guidelines. This issue was supposed to be fixed in 0.9.9-2, but was apparently overlooked. 2009-10-21 13:33:00 +00:00
the_fiddler
bdfa5fc9ec Avoid accessing OpenTK.Graphics.OpenGL from platform-specific code. Reduces coupling and code-duplication. 2009-10-21 10:16:32 +00:00
the_fiddler
25c646639b Trap WM_SYSCHAR to avoid generating system beeps on Alt+[Key] combinations. 2009-10-20 11:35:35 +00:00
the_fiddler
ddcf5f6e44 Revert WindowBorder and WindowState value changes.
Use Nullable types to detect when WindowBorder and WindowState is not set.
2009-10-19 21:32:33 +00:00
the_fiddler
2b7ed38569 * X11GLNative.cs: Added more defensive checks for the existence of the window before issuing XDestroyWindow.
Do not allow multiple calls to XDestroyWindow once the shutdown sequence has been initialized. Fixes issue [#1190]: "GameWindow dispose on linux".
2009-10-19 19:46:37 +00:00
the_fiddler
162faad8e3 * X11GLNative.cs: Correctly set all necessary ClientMessage fields
for XSendEvent call in Close() method.
2009-10-19 19:03:17 +00:00
the_fiddler
47c1cc69e5 * Functions.cs: Added helper function for XSendEvent, so that we
don't need to cast the EventMask to IntPtr.
2009-10-19 19:02:07 +00:00
the_fiddler
e2dd2cb58f * X11GLContext.cs: Correctly set GraphicsMode in constructor (resolves issue [#1175]: "Graphics] GraphicsContext.GraphicsMode property returns null on Linux"). 2009-10-19 18:11:32 +00:00
the_fiddler
38196c57f5 Added dllmap for OpenCL on Linux. 2009-10-19 17:53:59 +00:00
the_fiddler
0c9657c5e7 * X11GLNative.cs: Implemented Icon property for WMs that do not
respect _NET_WM_ICON (e.g. Gnome/Metacity/Compiz).
2009-10-19 10:42:28 +00:00
the_fiddler
a05d06b2d8 * Functions.cs: Added a number of missing methods relating to
XWMHints, images, pixmaps and root windows.
Implemented Create[Mask|Pixmap]FromImage methods.

* Structs.cs: Added ImageFormat enum.
2009-10-19 10:41:41 +00:00
the_fiddler
80350e41d1 Route overloads through GL class instead of calling the Delegates directly. Ensures that automatic error checking will work as expected. 2009-10-19 09:10:32 +00:00
the_fiddler
e551881f1b Implemented icon support. 2009-10-18 16:52:07 +00:00
the_fiddler
a3b2211547 Treat 0 as a special value (necessary for internal purposes). 2009-10-18 15:23:22 +00:00
the_fiddler
76ae6999cd Focused property now returns correct values. FocusedChanged event is now correctly raised. 2009-10-18 15:11:41 +00:00
the_fiddler
590789a684 Improved handling if WindowBorder changes when the window is WindowState is Maximized or Fullscreen. Maximized windows now correctly retain their maximized state, while fullscreen windows do not become non-fullscreen when their border is modified. 2009-10-18 14:56:53 +00:00
the_fiddler
6be563211f * API.cs: added MonitorFromWindow/MonitorFromPoint methods.
* WinGLNative.cs: fixed handling of WindowState.Maximized when WindowBorder is Hidden.
    WindowStateChanged events are now correctly raised on all state changes.
2009-10-18 09:42:41 +00:00
the_fiddler
c5464bc5d0 Do not print window title to debug stream inside the set_Title property. Instead, log an error only when the method call fails. Fixes issue [#1239]: "Debug.Print in Title property". 2009-10-17 22:02:08 +00:00
the_fiddler
158f1af9d3 Added distinct /overrides/add and /overrides/replace elements.
Added check for the existence of override elements before trying to use them (avoids potential null reference exception).
Regenerated bindings using the latest version of the generator.
2009-10-17 21:49:35 +00:00
the_fiddler
353ef37dd4 Fixed issue [#1240]: "Generic ref and out wrappers do not copy results to the reference parameter", by assigning the GCHandle.Target back to the reference parameter. 2009-10-17 20:02:53 +00:00
the_fiddler
b2bc058ac9 Added override for GetProgramInfoLog: infolog parameter should have a flow of 'out'. 2009-10-17 16:31:33 +00:00
the_fiddler
40aae28300 Fixed GetDouble implementation to return correct values (should call GetDouble not GetFloat!) Fixes issue [#1235]: "Matrix4d wrong value on GL.GetDouble". 2009-10-15 14:37:26 +00:00
the_fiddler
4abe4416a8 Added LoadIcon method.
Made SHFILEINFO non-public.
Modified WinGLNative.cs to use Icon.ExctractAssociatedIcon() to set the application icon (needs work).
2009-10-14 22:48:19 +00:00
the_fiddler
ef1a4488d0 Added support for setting the application (use SHGetFileInfo to retrieve the correct icon and set it when constructing a new window). 2009-10-14 21:50:40 +00:00
the_fiddler
973839ef2b Restore previous window size when leaving fullscreen mode. 2009-10-14 19:46:39 +00:00
the_fiddler
83514567f4 Corrected documentation on the M42 property. Fixes issue [#1227]: "Matrix4.M42 documentation". 2009-10-14 18:30:12 +00:00
the_fiddler
34f36d579f Added missing CreatePerspectiveFieldOfView and CreatePerspectiveOffCenter methods (fixes issue [#1226]: "Matrix4d.CreatePerspectiveFieldOfView").
Replaced several instances of float values by double equivalents.
2009-10-13 21:33:59 +00:00
the_fiddler
d76279565f Workaround for modal loop blocking in ENTERMENULOOP event. 2009-10-12 13:15:12 +00:00
the_fiddler
6dd6fedd08 * Enums.cs: Enums now use the inherit from the correct int or long type. 2009-10-09 06:03:12 +00:00
the_fiddler
5e95ec9fc4 * CL.cs: Removed invalid documentation. 2009-10-09 05:41:50 +00:00
the_fiddler
ab138bfb37 Post a close message instead of destroying the window outright, when the user calls the Close() method. Ensures that the user can stop the exit sequence through the IsClosing event. 2009-10-07 16:18:48 +00:00
the_fiddler
4482a79e84 * GameWindow.cs: Improved implementation of GameWindow.Exit(). It should now be possible to cancel the exit through the IsClosing event. 2009-10-07 16:13:46 +00:00
the_fiddler
e441e9d067 Generate Update/ResizeFrame events whenever the window is moved or resized. Partially fix for issue [#1218]: "[NativeWindow] Avoid modal loop during window resize/movement". 2009-10-07 15:18:53 +00:00
the_fiddler
c0528707c3 Refactored and simplified the Run() loop. 2009-10-07 13:08:13 +00:00
the_fiddler
a6984a7a48 Added timer callback to WM_ENTERSIZEMOVE messages to avoid stalling the rendering during the modal size/move loop (which occurs when the user clicks the window bar or borders). Still need to find a way to notify the frontend (GameWindow) to process queued up UpdateFrame/RenderFrame events. 2009-10-07 13:07:36 +00:00
the_fiddler
eaac78008b Added SetTimer, KillTimer and TimerProc bindings. 2009-10-07 13:03:32 +00:00
the_fiddler
c47eacee05 * OpenGL/GLHelper.cs: Removed static GetAddress method in favor of
implementation inherited from GraphicsBindingsBase.
Disabled unused code.
2009-10-07 11:23:40 +00:00
the_fiddler
5f93a2fb0d * GraphicsContext.cs: Removed unused code. 2009-10-07 11:22:48 +00:00