Commit graph

4881 commits

Author SHA1 Message Date
Stefanos A
342af2f927 Fixed file not found error
The debug.log would be deleted after launching an example, causing the
example browser to complain that the file cannot be found. In reality,
it should be deleted before launching an example - fixed.
2013-10-04 10:03:26 +02:00
Stefanos A
d81bedf5f8 Moved all input processing to Sdl2InputDriver
This reduces the duplication of code between Sdl2NativeWindow and
Sdl2InputDriver. Sdl2InputDriver is now solely responsible for handling
input.
2013-10-04 10:02:19 +02:00
Stefanos A
bad2b7b6d7 Implemented IDisposable in Sdl2Joystick
Sdl2Joystick calls SDL_JoystickOpen, which means we must call
SDL_JoystickClose on shutdown.
2013-10-04 10:00:57 +02:00
Stefanos A
79def664b8 No separate Factory.Embedded for SDL2
Sdl2Factory supports both desktop and embedded profiles, there is no
need to construct a separate Embedded profile.
2013-10-04 09:57:43 +02:00
Stefanos A
17b4f62151 Sdl2JoystickDriver.Poll() and axis fixes 2013-10-04 02:37:41 +02:00
Stefanos A
1434f0d3e9 Display joystick information 2013-10-04 02:37:05 +02:00
Stefanos A
a384df659b New SDL2 library with HiDPI support
Upgraded SDL2 to hg 7778:a571a9947869, which includes support for the
new SDL_WINDOW_HINT_HIDPI flag.
2013-10-04 01:44:20 +02:00
Stefanos A
af67a96759 Initial implementation of IJoystickDriver API 2013-10-04 01:39:22 +02:00
Stefanos A
b4c29d802b Add support for HiDPI modes
When HiDPI is enabled, the size of the OpenGL surface (specified in
pixels) may no longer correspond to the size of the window (specified
in points). Width, Height, ClientSize and ClientRectangle return the
size of the OpenGL surface in device-dependent pixel coordinates
(origin: top-left pixel of the surface). Bounds and Size return the
size of the window in device-independent point coordinates (origin:
desktop).
2013-10-04 01:38:19 +02:00
Stefanos A
913c4f16e6 Throw extension if context creation fails
This aligns behavior with that of the other platforms.
2013-10-03 17:22:13 +02:00
Stefanos A
80845315db Fallback to desktop context if embedded fails
Starting with OpenGL 4.1 and the ARB_ES2_compatibility extension, desktop contexts can execute OpenGL|ES code. This fallback will allow platforms to execute OpenGL|ES code even if EGL is not available (e.g. Nvidia/Windows).
2013-10-03 17:20:17 +02:00
Stefanos A.
94c02e827a NRE -> GraphicsContextMissingException
Throw a GraphicsContextMissingException if GraphicsBindingBase.LoadAll() is called without a current GraphicsContext.
2013-10-03 16:45:28 +02:00
Stefanos A.
0e221a0ce5 Load ES entry points even on desktop
Some drivers / operating systems export ES entry points as extensions on regular "desktop" GraphicsContexts. Attempt to load them even if the user has not explicitly asked for an ES context.
2013-10-03 16:42:38 +02:00
Stefanos A
be7200d37e Merge branch 'sdl2' of https://github.com/thefiddler/opentk
Conflicts:
	Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
2013-10-03 15:11:59 +02:00
Stefanos A.
f2eda16458 Serialize Sdl2NativeWindow methods
This change, along with moving DestroyWindow() to the Dispose() method
fixes crashes on shutdown.
2013-10-03 14:59:30 +02:00
Stefanos A.
3c867838e6 Reload WGL entry points in WinGLContext()
This fixes AccessViolationException when creating multiple contexts on
Intel hardware.
2013-10-03 14:04:34 +02:00
Stefanos A
d217e379d4 Added support for OpenGL ES through SDL2
If SDL2 is supported, the PlatformFactory will now use it for creating the OpenGL ES context. Previously, it would revert to the native drivers when GraphicsContextFlag.Embedded was specified.
2013-10-03 11:17:21 +02:00
Stefanos A.
f6da957639 Improved debugging messages
Exceptions that occur in the example process are now logged.
2013-10-02 17:55:57 +02:00
Stefanos A.
5051190b01 MouseButtonUp and MouseMove fixes
MouseMove no longer leaves the window borders when the cursor is
invisible. MouseButtonUp events are now reported even when they occur
outside the window. This aligns SDL2 behavior with the native drivers.
2013-10-02 17:55:30 +02:00
Stefanos A.
b077597bc1 Create Sdl2NativeWindow hidden
This conforms to the other platform drivers and looks better in general
(no delay between window creation and OpenGL context creation.)
2013-10-02 16:31:22 +02:00
Stefanos A.
4d7ba20a03 Fixed unsetting current context in SDL2
SDL_GL_MakeCurrent(IntPtr.Zero, IntPtr.Zero) is the correct way to
remove the current OpenGL context from the calling thread. Fixes
threaded rendering on Windows.
2013-10-02 16:26:47 +02:00
Stefanos A
a6b97f9b38 Added missing x64 unmanaged dependencies
The .gitignore file ignores directories starting with x64, causing these depedendencies to be missed. Fixed by adding them manually.
2013-10-02 15:25:37 +02:00
Stefanos A
c077d5c026 Added Mac OS X build of SDL2 to dependencies 2013-10-02 01:39:53 +02:00
Stefanos A
40cfcfaf25 Improved diagnostics in Dispose()
Leaked and disposed resources are now always reported.
2013-10-02 01:14:26 +02:00
Stefanos A
6360156d99 Added Sync object for SDL 2013-10-02 01:13:06 +02:00
Stefanos A
c77439ea6b Marked class as partial
This allows extension of the class without touching the upstream code.
2013-10-02 01:12:12 +02:00
Stefanos A
f8d9667653 Use separate process for executing examples
Using a separate, isolated process protects against incompatible interactions between the Example Browser (WinForms) and the executing example (native or SDL). It also protects the main GUI from crashes in the example code.
2013-10-02 01:10:03 +02:00
Stefanos A
31f2df094b Fixed invalid version string on git
Git commit hashcodes are not compatible with the 16bit integer values found in .Net version numbers. Use the git commit count as a version number instead.
2013-10-02 00:05:59 +02:00
Stefanos A.
7460452b26 MakeCurrent(null) should make context non-current
This fixes the crash in the "GameWindow Threading" example.
2013-10-01 22:13:33 +02:00
Stefanos A
2c867de1f4 Fixed build under xbuild
Mono xbuild does not recognize the DebugType none element in the project configuration. Remove this in order to make it happy.
2013-10-01 22:05:50 +02:00
Stefanos A
019f466130 Clean up OpenTK after every example
Use the IDisposable instance returned by OpenTK.Toolkit.Init() to shutdown OpenTK after the end of each example run.
2013-10-01 22:04:11 +02:00
Stefanos A
a85cecdc59 Improved resource disposal
Added IDisposable interface to all classes holding native data that must be freed. OpenTK.Toolkit.Init() now returns an IDisposable instance that can be used to cleanup all native data held by OpenTK. This is useful when re-initializing OpenTK (possibly in a new AppDomain), as is the case in the Example browser.
2013-10-01 22:01:27 +02:00
Stefanos A.
ff9cd61777 Removed terrible hack for SDL_WINDOW_OPENGL
SDL2 will refuse to create an OpenGL context on a window with the SDL_WINDOW_FOREIGN flag (i.e. windows that are passed to SDL2 through SDL_CreateWindowFrom). This must be fixed upstream.
2013-10-01 21:05:02 +02:00
Stefanos A.
b57e58dc47 Implemented Sdl2GLControl
SDL2 still fails with "not an OpenGL window".
2013-09-30 20:47:29 +02:00
Stefanos A
5bb23585b9 Merge remote-tracking branch 'origin/master' into sdl2 2013-09-30 18:29:55 +02:00
Stefanos A.
ddd070579a Workaround for NRE on WinRawMouse driver
On some systems, the Windows Raw Input driver fails to find the name of
a mouse device, causing a NRE. Since the name is not vital information,
a dummy name is generated as a workaround.
2013-09-30 18:27:13 +02:00
thefiddler
071daff564 Merge branch 'sdl2' of https://github.com/thefiddler/opentk into sdl2 2013-09-30 14:43:06 +02:00
Stefanos A.
ea0c845eb0 Attempted to fix key modifier state
SDL2 does not report keydown and keyup events on modifiers keys until
you release them. Attempted to fix this using SDL_GetModifierState, but
this does not appear to work. Should hit upstream.
2013-09-30 14:20:33 +02:00
Stefanos A.
7fe73253a7 Renamed Sdl2InputBase 2013-09-30 14:19:10 +02:00
Stefanos A.
c53773f4ec Use scancodes for KeyboardDevice states
This resolves the issue where different layouts would return different
keys when pressing the same physical key. A new API must be introduced
for text input.
2013-09-30 13:51:31 +02:00
Stefanos A.
5e35411dd1 Fixed return values of keyboard functions
SDL_GetKeyFromScancode and SDL_GetScancodeFromKey should return a
SDL_Keycode or SDL_Scancode respectively, instead of void.
2013-09-30 13:49:53 +02:00
Stefanos A.
fc8b3810e9 Fixed documentation comment 2013-09-30 13:48:12 +02:00
Stefanos A.
2d19edf3fe Renamed Sdl2InputBase to Sdl2InputDriver
Sdl2InputDriver describes the role and function of this class more
accurately.
2013-09-30 13:13:02 +02:00
Stefanos A.
7cb3965e25 Made internal SDL2 API private 2013-09-30 12:22:51 +02:00
Stefanos A.
5a55cb5cca Implemented SDL2 mouse and keyboard drivers 2013-09-30 12:22:25 +02:00
thefiddler
778087fe3a Reduced icon resolution to 128x128 in order to avoid "out of memory" errors when building with Mono. 2013-09-30 11:09:14 +02:00
Stefanos A.
fcc9049d18 Added high-res icons to Example Browser
The Example Browser should now look better on high resolution screens.
2013-09-29 23:58:10 +02:00
Stefanos A.
cfdb5bc95a Free SDL surface after updating the window icon
The SDL surface is no longer needed and will cause a memory leak if not
freed. Additionally, the decoded BitmapData should not be unlocked until
after updating the window icon, as it may be moved by the GC otherwise.
2013-09-29 23:36:28 +02:00
Stefanos A.
420ec232f3 Fixed decoding of Icons
The rgba mask for decoding icon surfaces was incorrect. Icons should
appear as expected now.
2013-09-29 23:08:51 +02:00
Stefanos A.
6245ffe3ef Updated license information 2013-09-27 23:07:23 +02:00