Commit graph

5646 commits

Author SHA1 Message Date
thefiddler
4ca8c78764 [OpenTK] Suggest alternative to obsolete INativeWindow.InputDriver property 2014-01-14 23:40:23 +01:00
Stefanos A.
4473c8373e [X11] Implemented joystick hotplugging
This is a work in progress.
2014-01-14 18:37:16 +01:00
Stefanos A.
b004dc7a0a [X11] Added INotify.cs to project files 2014-01-14 18:36:36 +01:00
Stefanos A.
4203c14b22 [X11] Removed IJoystickDriver from X11Joystick
Legacy IJoystickDriver support is now implemented through a
LegacyJoystickDriver instance.
2014-01-14 18:36:19 +01:00
Stefanos A
f3036e5f10 Merge branch 'develop' into linux_joystick 2014-01-14 18:26:05 +01:00
Stefanos A
cb4e4d5e72 Merge branch 'legacy_joystick' into linux_joystick 2014-01-14 18:17:05 +01:00
Stefanos A.
d467629ad8 [Linux] Added INotify bindings
These are not currently used.
2014-01-14 18:15:53 +01:00
Stefanos A
962a9f7733 Merge branch 'issue43_unstablefps' into develop 2014-01-14 14:21:19 +01:00
Stefanos A.
0c9b612bff [OpenTK] Increase max Update/RenderFrame rates
Given the new 144Hz monitors on the market today, it makes sense to
increase the Update/RenderFrame limit from 200Hz to 500Hz.
2014-01-14 14:20:38 +01:00
Stefanos A.
1f44cf27a1 [OpenTK] Do not hang when update rate too high
OpenTK will now detect when an UpdateFrame handler is consistently
taking too long to finish, and stop raising UpdateFrame events. This
gives ProcessEvents() a chance to execute and will protect the
application from hanging up.
2014-01-14 13:55:24 +01:00
Stefanos A.
95d71bc0cc [OpenTK] Respect a TargetUpdatePeriod of zero 2014-01-14 13:33:41 +01:00
Stefanos A.
7b98255626 [Examples] Improved timing display
GameWindowStates will now display the average fps and draw three moving
boxes based on different timing methods.

If the timing implementation in OpenTK is working correctly, all three
boxes should be moving at the same speed.
2014-01-14 13:27:09 +01:00
Stefanos A.
97e49b76b2 [OpenTK] Fix UpdateFrame quantization error
The UpdateFrame event rate will now match TargetUpdatePeriod even if
vsync is enabled. Previously, it would be quantized to a multiple or
integer fraction of of the vsync rate.
2014-01-14 13:04:30 +01:00
Stefanos A.
3eccb89821 [OpenTK] Remove Thread.Sleep() from loop timing 2014-01-13 11:36:56 +01:00
Stefanos A.
b3554bb74c [OpenTK] Simplified update and render loops 2014-01-13 11:22:33 +01:00
thefiddler
7afe48c979 [Audio] Don't crash when Alc.GetString() returns null
Alc.GetString() could crash if the unmanaged code returned null due to
any kind of failure. This is now fixed and better documented.

Additionally, the array overload for Alc.GetString() will now correctly
forward the ‘device’ parameter to unmanaged code.
2014-01-12 22:05:15 +01:00
Stefanos A.
fca9f930e4 [OpenTK] Fix UpdateFrame loop condition
Multiple UpdateFrame events should be raised to match the desired
TargetUpdateFrequency, when TargetUpdateFrequency > 0. The loop would
incorrectly check for TargetRenderFrequency instead.

Affects issue #43
2014-01-12 21:37:18 +01:00
Stefanos A.
c31f64f7e1 [OpenTK] Frameskip needs TargetUpdateFrequency!=0 2014-01-11 01:46:38 +01:00
Stefanos A.
19eb72b3a9 [OpenTK] Fixed Utilities.CreateSdl2WindowInfo
Utilities.CreateSdl2WindowInfo should store the specified windowHandle
directly instead of trying to call SDL.SDL.CreateWindowFrom.
2014-01-10 16:56:26 +01:00
Stefanos A.
aff9719872 [SDL2] Implemented GetWindowWMInfo 2014-01-10 16:55:20 +01:00
Stefanos A.
bdfcf43e0b [Win] More robust pixel format selection
This patch adds more robust checks for WGL_ARB_pixel_format and
WGL_ARB_multisample before using the relevant extensions, and adds
checks whether Wgl.Arb.ChoosePixelFormat() returns a valid pixel format
before trying to use it (thanks to Repetier for catching this edge
case.)

Additionally, the ChoosePixelFormatPFD code-path now heavily penalizes
single-buffered modes when the user requests a double-buffered mode.

Affects issues #42 and #45
2014-01-10 15:41:57 +01:00
Stefanos A.
ef5aedba6f [Win] More robust WGL extension detection
Affects issue #42 and issue #45
2014-01-10 09:24:59 +01:00
thefiddler
a4d2a31386 [Mac] OpenGL 3.x/4.x require core profile flag
SDL will fail to construct an OpenGL 3.x/4.x context on Mac OS X,
unless ContextProfileFlags.CORE is specified.

Fixes issue #44

Upstream enhancement request at
https://bugzilla.libsdl.org/show_bug.cgi?id=2342
2014-01-09 23:36:28 +01:00
Stefanos A.
7f64945079 [OpenTK] Do not raise *Frame events when time = 0
Affects issue #40
2014-01-09 00:51:09 +01:00
thefiddler
bcc2405002 Merge branch 'rdp' into develop 2014-01-09 00:19:42 +01:00
Stefanos A.
28ac3cec0b [Win] Fix issue #35 (OpenTK over Remote Desktop)
When running over remote desktop without hardware acceleration, there
are no GraphicsModes that support desktop composition. This patch adds
logic to avoid requesting composition-capable modes when running over
RDP.

Additionally, it changes the mode selection logic to consider modes that
support features partially (e.g. 16bpp color instead of 32bpp), albeit
with a heavy penalty over fully supported modes.
2014-01-09 00:14:25 +01:00
Stefanos A.
1b3b510376 [Win] Check registry keys before accessing
Fixes crashes when using OpenTK over the Remote Desktop Client for Mac
(version 2010).
2014-01-09 00:10:41 +01:00
thefiddler
811126c47b Merge pull request #38 from opentk/issue34
Fix for issue #33 and issue #34
2014-01-08 13:36:32 -08:00
Stefanos A.
4af9d30ccb [Win] Fix issue #33; fix issue #34
This patch adds a workaround for WM_STYLECHANGED messages that are not
delivered when running on Mono/Windows. If we detect Mono, then we call
HandleStyleChanged() directly in order to update the internal state of
our WinGLNative instance.
2014-01-08 22:29:22 +01:00
Stefanos A.
51ad513dbb [Win] Do not overload internal SetWindowLong
The internal function is now appended with "Internal".
2014-01-08 19:22:03 +01:00
Stefanos A.
7363cfee7b [Win] Do not unregister class twice
Only the parent window would register a class, but both the parent and
the child window would unregister it. This is now fixed.
2014-01-08 19:21:29 +01:00
Stefanos A.
51baed7286 [Win] Remove unnecessary #if clauses 2014-01-08 00:45:42 +01:00
Stefanos A.
e260a42954 [Win] Refactor huge wndproc into functions 2014-01-08 00:02:27 +01:00
thefiddler
eacc896605 Merge branch 'timing' into develop 2014-01-07 22:19:22 +01:00
Stefanos A.
a961fb3db3 [Examples] Added keys to modify timing
Use [ and ] to decrease and increase the UpdateFrame frequency.
Use < and > to decrease and increase the RenderFrame frequency.
2014-01-07 22:09:52 +01:00
Stefanos A.
b6a806a568 [OpenTK] Improved timing stability
OpenTK now directly calculates the elapsed time between UpdateFrame
(RenderFrame) events and compares that directly to TargetUpdatePeriod
(TargetRenderPeriod). This significantly simplifies the implementation
and improves timing stability.
2014-01-07 22:09:02 +01:00
Stefanos A.
6e03d501ae [OpenTK] Fixed Update/RenderTime calculation
These values should only be re-calculated when an Update/RenderFrame
event is raised. Otherwise, they should retain their previous values.
2014-01-07 15:55:11 +01:00
thefiddler
251f5717ae [Examples] Improve timing information; add vsync toggle 2014-01-07 09:12:35 +01:00
thefiddler
99df27b635 [OpenTK] Corrected GameWindow.Update/RenderFrequency information 2014-01-07 09:11:55 +01:00
thefiddler
56a3dd91e5 [OpenTK] Implemented GameWindow.UpdateTime and RenderTime properties 2014-01-07 09:09:43 +01:00
thefiddler
3856fcd48e [OpenTK] More robust timing for UpdateFrame and RenderFrame
FrameEventArgs.Time should no longer drift from clock time measured
outside GameWindow.
2014-01-07 08:52:02 +01:00
thefiddler
c5dcc8a93b [Examples] Calculate timing information in GameWindowStates 2014-01-07 01:01:00 +01:00
thefiddler
d49dacb5b3 [Examples] Cleaned up input device printing in GameWindowStates 2014-01-07 00:48:09 +01:00
thefiddler
94c3c24bfb [OpenTK] Platform backends should inherit from PlatformFactoryBase
This reduces code duplication wrt deprecated interfaces and common
support code between backends.
2014-01-06 14:49:05 +01:00
thefiddler
d84be0d594 [OpenTK] Added base IPlatformFactory implementation
PlatformFactoryBase provides a common base interface for platform
backends. Platform backends should inherit from PlatformFactoryBase in
order to reduce code duplication.
2014-01-06 14:47:58 +01:00
thefiddler
a94a293732 [Platform] Implemented legacy IJoystickDriver
LegacyJoystickDriver implements the legacy IJoystickDriver interface
(GameWindow.Joysticks) in terms of the new IJoystickDriver2 interface
(OpenTK.Input.Joystick).

This removes a large chunk of code from each platform backend, as they
no longer need to implement IJoystickDriver themselves. Additionally,
it adds support for device hot plugging which was previously missing.
2014-01-06 14:25:05 +01:00
Stefanos A.
83f54f70aa [OpenTK] Simplify and improve timing calculations
This patch modifies GameWindow.Run() to use a single stopwatch instead
of two separate stopwatches for timing UpdateFrame and RenderFrame
events.

It improves timing accuracy for issue #20 (FrameEventArgs.Time
Inconsistencies)
2014-01-06 01:57:54 +01:00
Stefanos A.
88c57db5b6 [Math] Added MathHelper.Clamp 2014-01-06 01:52:08 +01:00
thefiddler
a9ab3650da [Mac] Do not store *State structs directly
Storing Mouse/KeyboardState structs directly makes updates more
difficult than they should be. It is simpler to create simple classes
instead.
2014-01-05 23:58:05 +01:00
thefiddler
4d660fdeba [Input] Added Keyboard/MouseState.SetIsConnected to mirror JoystickState 2014-01-05 23:50:17 +01:00