Commit graph

3668 commits

Author SHA1 Message Date
Stefanos A.
e260a42954 [Win] Refactor huge wndproc into functions 2014-01-08 00:02:27 +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
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
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
thefiddler
fda2d32d2d [Mac] Map GamePads, MultiAxisControllers and Wheels to joysticks 2014-01-05 22:44:58 +01:00
thefiddler
a1123834a0 [Mac] Call DeviceRemoved() in Dispose() event
The necessary cleanup code already exists in DeviceRemoved(). No need
to duplicate this in the Dispose() event.
2014-01-05 22:38:26 +01:00
thefiddler
ab85afd5ba [Mac] Avoid IOHIDDeviceConformsTo call in DeviceRemoved handler
DeviceAdded already checks that devices conform to the desired usage
pages. Checking again in DeviceRemoved is unnecessary - if a device
exists, then it has already passed muster.
2014-01-05 22:36:01 +01:00
thefiddler
9e223486f6 [Mac] Implement Joystick.GetGuid() 2014-01-05 22:15:55 +01:00
thefiddler
5c5afb3ea3 [Mac] Calculate joystick Guid for USB devices 2014-01-05 22:06:19 +01:00
thefiddler
b458b40683 [Mac] Use out/ref parameters instead of unsafe pointers in bindings 2014-01-05 22:05:54 +01:00
thefiddler
fa386dc991 [Mac] Connect devices to first available index 2014-01-05 21:53:28 +01:00
thefiddler
05af21e61b [Mac] Do not call CFRelease on HID properties
HID properties are callee-owned and should not be released by the
caller. Fixes crash (memory corruption) on device hot plugging.
2014-01-05 21:27:34 +01:00
thefiddler
02c9f471ea [Mac] DllImport must be marked as extern 2014-01-05 21:18:20 +01:00
thefiddler
7388bd935d [Mac] Correctly unschedule HIDManager from run loop 2014-01-05 20:17:03 +01:00
thefiddler
4c7f6a92a7 [Mac] Don't let exceptions escape to unmanaged code 2014-01-05 04:20:51 +01:00
thefiddler
892d129e54 [Mac] Fixed DllEntryPointNotFound crash on device unplugging 2014-01-05 04:15:30 +01:00
thefiddler
2ee24efb2f [Mac] Implemented joystick buttons 2014-01-05 04:11:11 +01:00
thefiddler
fad42994e1 [Mac] Implemented joystick axis movement 2014-01-05 03:54:53 +01:00
thefiddler
92635b3f35 [Input] Added JoystickAxis/Button.Last; added JoystickAxis.Axis10.
JoystickAxis/Button.Last is used internally to allocate the correct
amount of storage for joystick axes and buttons. JoystickAxis.Axis10 is
required to support the maximum number of axes available on Mac OS X.
2014-01-05 03:54:34 +01:00
thefiddler
59249c2624 [Mac] Implemented joystick device detection 2014-01-05 03:03:46 +01:00
thefiddler
07bcda0f57 [Mac] Retrieve HID joystick name 2014-01-05 02:42:47 +01:00
thefiddler
6dadbd3570 [Mac] Implemented necessary CFString methods 2014-01-05 02:42:33 +01:00
thefiddler
32653d2c64 [Mac] Construct JoystickDevice when joysticks are connected 2014-01-05 00:47:40 +01:00
thefiddler
3757db9978 [Input] Allow extending JoystickDevice<> 2014-01-05 00:46:59 +01:00
thefiddler
bf8efea121 [Mac] Only add callbacks for recognized USB HID devices 2014-01-05 00:00:49 +01:00
thefiddler
c44b477388 [Mac] Implement device added/removed events for joysticks 2014-01-04 23:58:59 +01:00
thefiddler
9659a1d786 [Mac] Add skeleton HID input implementation for joysticks 2014-01-04 23:55:38 +01:00
thefiddler
3a63496b6d Merge branch 'gamepad' into develop
Conflicts:
	Source/OpenTK/OpenTK.csproj
2014-01-03 02:23:02 +01:00
thefiddler
514390fc9a [Graphics] Added missing documentation comment 2014-01-03 02:18:28 +01:00
thefiddler
53552b0070 [Input] Corrected malformed documentation comments 2014-01-03 02:17:42 +01:00
thefiddler
3095afa18a [Input] Documented all public members 2014-01-03 01:58:16 +01:00
thefiddler
b35aad1503 [Input] Removed JoystickState.GetAxis(int) overload 2014-01-03 01:58:08 +01:00
thefiddler
8649e4a044 [Input] Added SetVibration() API skeleton 2014-01-02 19:52:00 +01:00
thefiddler
ec43b9ff85 [Input] GamePad and Joystick classes should be sealed 2014-01-02 19:27:04 +01:00
thefiddler
b513e35ea8 [SDL2] Implemented PacketNumber property 2014-01-02 19:24:38 +01:00
thefiddler
1ccf7e5ad2 [Input] Added PacketNumber property 2014-01-02 19:24:15 +01:00
thefiddler
b5d42b7992 [Input] Implemented GetState() and simplified GetCapabilities() 2014-01-02 18:37:53 +01:00
thefiddler
d49af2787f [Input] Simplified configuration parser and added GetEnumerator() 2014-01-02 18:37:20 +01:00
thefiddler
8f00bbc9f2 [Input] Added internal Joystick.GetAxisRaw() method 2014-01-02 18:36:27 +01:00
thefiddler
0593ea62e6 [Input] Added Source and Target to GamePadConfigurationItem 2014-01-02 18:36:09 +01:00
thefiddler
bf5d2a738d [Input] Made configuration database non-static 2014-01-02 02:42:51 +01:00
thefiddler
9e4827bf67 [SDL2] Fixed SDL_JoystickGetGUID capitalization 2014-01-02 02:20:51 +01:00
thefiddler
a8fb977017 [Input] Initialize JoystickDevice.Details in constructor 2014-01-02 02:20:25 +01:00
thefiddler
fb57a9062d [Input] Renamed GamePadMap to GamePadConfiguration 2014-01-02 01:38:12 +01:00
thefiddler
dc1ffab78d [Input] Implemented IGamePadDriver.GetName() 2014-01-02 01:34:21 +01:00
thefiddler
c2c76f2ab2 [Input] Made the Name property public
We can use the name property to implement a hypothetical
GamePad.GetName() method in the future.
2014-01-02 01:33:57 +01:00
thefiddler
b056a50e73 [Input] Added xml documentation for GamePadCapabilities 2014-01-02 01:33:08 +01:00
thefiddler
a0dad7f698 [Input] Implemented MappedGamePadDriver.GetCapabilities() 2014-01-02 01:13:20 +01:00
thefiddler
f0fbb26efe [Input] Added ability to parse SDL configuration db strings 2014-01-02 01:07:21 +01:00
thefiddler
5e75fac056 [Input] Added configuration db for GamePads
The database is based on the SDL bindings found at
https://hg.libsdl.org/SDL/file/b744b3f8754b/src/joystick/SDL_gamecontrol
lerdb.h
2014-01-02 01:06:47 +01:00
thefiddler
b9a8e365de [Input] Added IJoystickDriver2.GetGuid() API 2013-12-31 14:09:17 +01:00
thefiddler
cd143af60a [SDL2] Added JoystickGetGUID method 2013-12-31 14:08:28 +01:00
thefiddler
1687518ef5 [SDL2] Add compile-time check for SDL2 GameController vs MappedGamePadDriver 2013-12-31 11:46:40 +01:00
thefiddler
ef7f31099d [Input] Removed unnecessary #region 2013-12-31 01:02:07 +01:00
thefiddler
7d4d116ce9 [Input] Renamed GamePadMapping to GamePadMap 2013-12-31 01:01:52 +01:00
thefiddler
d4348c5083 [SDL2] Fixed joystick/controller hotplugging support 2013-12-30 17:22:45 +01:00
thefiddler
9c8a5f5028 [SDL2] Fixed GameControllerButton to Buttons translation 2013-12-30 17:15:49 +01:00
thefiddler
43ef78f222 [SDL2] Fix issue where changes to mutable struct were lost 2013-12-30 17:09:20 +01:00
thefiddler
9beb396c9e [SDL2] Explicitly enable joystick and gamepad events 2013-12-30 17:08:42 +01:00
thefiddler
2d303a6884 [Input] Buttons should have [Flags] attribute 2013-12-30 16:07:06 +01:00
Stefanos A.
6faa58aac3 [SDL2] Fixed joystick hotplugging
SDL2 uses a weird system of device ids and instance ids to report
joystick events, where the ADDED event uses a device id and the rest use
instance ids.

The SDL2 joystick driver is now fixed to correctly distinguish between
the two, which fixes hotplugging support for joystick devices.
2013-12-30 15:24:48 +01:00
thefiddler
52b8762593 [SDL2] Fixed mapping of instance ids to device ids 2013-12-30 14:57:28 +01:00
thefiddler
a4366e52f5 [Input] Added missing closing brace in ToString() message 2013-12-30 14:56:22 +01:00
thefiddler
064a45e4a7 [Input] Fixed incorrect variable name 2013-12-30 13:49:26 +01:00
thefiddler
1b0a72472e [SDL] Use TranslateAxis() to decode ControllerAxisEvent
SDL GameControllerAxis and GamePadAxes are not interchangeable. The
driver will now correctly interpret incoming SDL messages and update
the GamePadState for the relevant axis.
2013-12-30 13:42:37 +01:00
thefiddler
e997ddf9c6 [Input] Fixed GamePadState.SetAxis() implementation
GamePadState.SetAxis() receives a GamePadAxes enumeration, which is a
bitmask of the axes we wish to set. SetAxis now correctly decodes the
bitmask to apply the values we are interested in.
2013-12-30 13:39:43 +01:00
thefiddler
0b8db7c40b [X11] Removed unused variable 2013-12-30 10:25:17 +01:00
thefiddler
4005710b99 [X11] Fixed current resolution detection. 2013-12-30 09:23:33 +01:00
thefiddler
3dbf575765 [Build] Added new files to the relevant csproj scripts 2013-12-28 01:23:39 +01:00
thefiddler
04e6d9335a [Graphics] Improved support for external OpenGL contexts
When combining OpenTK with a third-party OpenGL toolkit, it is now
possible to implement a suitable GetAddress() and GetCurrentContext()
implementation in terms of the third-party toolkit. If no
implementation is specified, then OpenTK will try to guess the most
suitable implementation within its own platform backends.

If no custom implementation is defined, and if no suitable
implementation can be found, then OpenTK will throw a
PlatformNotSupportedException. If a suitable implementation is found or
defined, then OpenTK will attempt to load OpenGL entry points using
that implementation.

In this case third-party toolkit remains solely responsible for
managing its context via its MakeCurrent(), SwapBuffers(), etc
implementations.
2013-12-28 01:14:59 +01:00
thefiddler
5cebaccfca [Dummy] Improved thread-safety; added entry-point loader
DummyGLContext will now attempt to load OpenGL and OpenGL ES entry
points when a suitable OpenGL context is current on the calling thread.
This allows OpenTK to be used on contexts created through third-party
toolkits.
2013-12-28 01:09:59 +01:00
thefiddler
8bcbb06f8e [Platform] Added internal CreateGetAddress() function
CreateGetAddress() constructs a GraphicsContext.GetAddressDelegate that
is suitable for the current platform. This can be used when combining
OpenTK with an OpenGL context created through a third-party toolkit.
2013-12-28 01:08:24 +01:00
thefiddler
cf76aa6085 [Mac] Moved GetAddress implementation to its own class
The functions defined in libdl.dylib are useful in more places than
just AglContext. Moving them to their own class ensures we can access
these from wherever we might need them.
2013-12-28 01:06:33 +01:00
thefiddler
9171977079 [SDL2] Added missing [SuppressUnamangedCodeSecurity] attribute 2013-12-28 01:04:46 +01:00
thefiddler
b79d951e62 [Mac] Use Cgl.GetCurrentContext instead of Agl
CGL appears to work with both AGL and NSOpenGL contexts, whereas AGL is
limited to AGL contexts. This allows us to be more flexible in terms of
implementation (i.e. we can use Cgl.GetCurrentContext to retrieve a
handle to a context created through SDL, which uses NSOpenGL
internally.)
2013-12-28 01:04:22 +01:00
thefiddler
0d1df41393 [X11] Improve GraphicsMode fallback (fixes issue #23)
When the user requests a GraphicsMode that is not directly supported
by the GPU/drivers, we should relax the requested parameters until
we find a supported mode. An exception should only be thrown when
there is no usable mode.

This makes the X11 backend match the behavior of Windows. The SDL/X11
backend works a little bit differently, in that it falls back to the
a default mode directly if the requested mode is not available. There
is nothing we can do about that.
2013-12-27 14:01:21 +02:00
thefiddler
88f7cd68f5 [X11] Fixed border size on Gnome 3
The _NET_FRAME_EXTENTS atom is implemented differently by
different window managers, when window decorations are hidden
with Motif. Unity returns a 0 size, while Gnome 3 returns the
previous size.

This patch removes that ambiguity: when decorations are hidden,
border size becomes zero. This should work everywhere, unless
some window manager decides to troll us by decorating the window
when we explicitly request no decorations. Sigh...
2013-12-27 13:31:51 +02:00
thefiddler
ab8796c942 [Input] Do not crash with scancodes > 255 2013-12-27 11:10:41 +01:00
thefiddler
6c6e09aae6 [X11] Allow resizing with fixed borders
Windows can now be resized programmatically, even when they have
WindowBorder.Fixed. All resizing logic is now consolidated in the
Bounds property, and ConfigureNotify messages are now handled
correctly depending on their source (StructureNotify or
SubStructureNotify.)
2013-12-27 11:07:38 +01:00
thefiddler
4d27b6ee55 Implemented X11 KeyDown/KeyUp events and reduced code duplication 2013-12-25 11:46:02 +01:00
thefiddler
ffdf881cea Do not raise KeyPress for control characters 2013-12-25 11:14:30 +01:00
thefiddler
f7fbf38c43 IsButtonBind should check for buttons, not axes 2013-12-25 01:47:27 +01:00
thefiddler
b4b8bc1665 Implemented SDL IJoystickDriver2 and IGamePadDriver 2013-12-24 19:15:23 +01:00
thefiddler
c51c4934df Added GameControllerGetBind APIs 2013-12-24 19:14:54 +01:00
thefiddler
6fc679c4ba Removed duplicate button types 2013-12-24 19:14:35 +01:00
thefiddler
1eb807bb64 Use IGamePadDriver through MappedGamePadDriver 2013-12-24 17:18:05 +01:00
Stefanos A
7fd7b8c7a2 Improved ToString implementation 2013-12-24 17:18:05 +01:00
Stefanos A
9a90772cef Fixed WinMM offsets for IJoystickDevice2 2013-12-24 17:18:05 +01:00
Stefanos A
f3cb578587 Improved WinMMJoystickDriver hotplugging behavior 2013-12-24 17:18:05 +01:00
Stefanos A
82a2c9113c Implemented structural equality 2013-12-24 17:18:04 +01:00
Stefanos A
890d56ae63 Connected XInput driver 2013-12-24 17:18:04 +01:00
Stefanos A
15c01d0d5c WinMMJoystick implements IJoystickDriver2
WinMM is optimized for general joystick use, not for the canonical
GamePad layout. Instead of exposing IGamePadDriver directly, it should
expose IJoystickDriver2 and use a mapping driver to get GamePad support.
2013-12-24 17:18:04 +01:00
Stefanos A
165aa5bde6 Added MappedGamePadDriver skeleton implementation 2013-12-24 17:18:04 +01:00
Stefanos A
02fb6bf2f9 Implements JoystickState and Capabilities setters 2013-12-24 17:18:04 +01:00
Stefanos A
91b54cfbf3 No reason to comment out #region License 2013-12-24 17:18:04 +01:00
Stefanos A
52daef4b0d Added internal GamePadMapping class 2013-12-24 17:18:04 +01:00
Stefanos A
2839db587e Implemented thumbsticks and trigger caps 2013-12-24 17:18:04 +01:00
Stefanos A
7e5307bd4a Added IJoystickDevice2 interface 2013-12-24 17:18:03 +01:00
Stefanos A
e2d86fdf52 Implemented initial XInput IGamePadDriver 2013-12-24 17:18:03 +01:00
Stefanos A
b62f5993d4 Added missing left/right triggers 2013-12-24 17:18:03 +01:00
Stefanos A
ddc52ce135 Implemented GamePad Capabilities and Type 2013-12-24 17:18:03 +01:00
Stefanos A
dd648a8362 Initial implementation of GamePadTriggers 2013-12-24 17:18:03 +01:00
thefiddler
8f7eebb58d Enabled HIDInput IGamePadDriver implementation 2013-12-24 17:18:02 +01:00
Stefanos A
5d88a8daf4 Implemented GamePad API (WIP) 2013-12-24 17:18:02 +01:00
Stefanos A
0875cbd928 Removed unnecessary IsButtonValid method 2013-12-24 17:18:02 +01:00
Stefanos A
1adc3f7733 Display start button in ToString() 2013-12-24 17:18:02 +01:00
Stefanos A
44351a03c4 More robust handling of device add/remove events 2013-12-24 17:18:02 +01:00
Stefanos A
31ce400a7e Fixed expansion of joysticks collection 2013-12-24 17:18:02 +01:00
Stefanos A
2f1a81da2c Log errors in subsystem initialization 2013-12-24 17:18:02 +01:00
Stefanos A
1d61bd9dd2 Reuse Sdl2Factory.InputDriver in Sdl2NativeWindow 2013-12-24 17:18:01 +01:00
Stefanos A
a72d70c3d0 Delay joystick initialization until necessary 2013-12-24 17:18:01 +01:00
Stefanos A
3660509dee Added SDL_InitSubSystem method 2013-12-24 17:18:01 +01:00
Stefanos A
4a13415fc6 Fixed x/y axis mixup. 2013-12-24 17:18:01 +01:00
Stefanos A
1ba5fd4380 Cleaned up using directives 2013-12-24 17:18:01 +01:00
Stefanos A
76a35c0b91 Added missing newline 2013-12-24 17:18:01 +01:00
Stefanos A
91d248ad29 Implemented GamePadThumbSticks 2013-12-24 17:18:01 +01:00
Stefanos A
0c10f29bd8 More compact string representation 2013-12-24 17:18:00 +01:00
Stefanos A
1acf8a807b Implemented IEquatable<> interface 2013-12-24 17:18:00 +01:00
thefiddler
2bf024a912 Implemented new GamePad interface (WIP) 2013-12-24 17:18:00 +01:00
thefiddler
ecd04a3cad Implemented GamePadButtons 2013-12-24 17:18:00 +01:00
thefiddler
484af18673 Updated internal IGamePadDriver interface 2013-12-24 17:18:00 +01:00
thefiddler
ee65f81f56 Implemented GameController API bindings 2013-12-24 17:18:00 +01:00
thefiddler
d9985fc571 Use SDL2 event API for joystick devices 2013-12-24 17:18:00 +01:00
thefiddler
022e5c845c Implemented SDL2 Joystick and GameController events 2013-12-24 17:17:59 +01:00
thefiddler
d7fefe495e Removed unused constructors 2013-12-23 21:43:17 +01:00
thefiddler
95270c877d Added Compositing and FrameworkScaled flags 2013-12-23 21:42:16 +01:00
thefiddler
1189b33ed5 Fixed OpenTK/Carbon key repeat behavior to match the other backends 2013-12-23 20:40:27 +01:00
thefiddler
c13d80d6d8 Fixed GameWindow.{Bounds, Location, Size, X, Y} setters on OpenTK/Carbon 2013-12-23 20:21:02 +01:00
thefiddler
c6a21a2239 Implemented KeyDown & KeyUp events on OpenTK/Carbon 2013-12-23 19:32:16 +01:00
Stefanos A.
30cd9cb7f8 Fixed crash in MakeCurrent(null)
MakeCurrent(null) should set the bound device context to zero.
2013-12-22 11:10:05 +01:00
Stefanos A.
0a46e20029 Added WGL_DRAW_TO_WINDOW_ARB flag
Without this flag, OpenGL rendering does not work as expected.

Additionally, all WGL_ARB_pixel_format attributes are expected to be
specified in key-value pairs. Fixed double-buffering and stereoscoping
rendering attributes.
2013-12-22 10:35:05 +01:00
Stefanos A.
a2744719d5 Improved WGL mode selection
Fixed WGL_ARB_pixel_format attribute selection for doublebuffering,
stereoscopic rendering and hardware acceleration. Implemented
minimization strategy to select the optimal PixelFormatDescriptor in the
fallback path.
2013-12-22 09:20:40 +01:00
Stefanos A.
956bbe6491 Fixed DescribePixelFormatPFD
When using the PFD codepath, we now call DescribePixelFormat to retrieve
an exact interpretation of the pixel format selected by the driver.
2013-12-21 23:35:55 +01:00
Stefanos A.
1723be8a8b Prioritize accelerated formats first
Instead of creating a list of all available formats and iterating
through that, we let the driver decide which is the best accelerated
format to use for the user parameters. If no such format exists, we fall
back to generic acceleration or software acceleration, in turn.

This affects issue #21
2013-12-21 22:43:35 +01:00
Stefanos A.
a7ae4bb038 Turn 1-element array to ref/out param 2013-12-21 22:41:35 +01:00
Stefanos A
fd0c086e3d Marshal strings as UTF8 (affects #18)
Starting with OpenGL 4.2, strings passed to GL.ShaderSource are allowed
to contain multi-byte characters in comments (issue #18). This patch
modifies the marshaling code to use UTF8.GetBytes in order to marshal
strings, instead of Marshal.StringToHGlobalAnsi().
2013-12-21 00:51:34 +01:00
Stefanos A.
0c990583a3 Implemented KeyDown and KeyUp messages 2013-12-21 00:50:25 +01:00
Stefanos A.
42ce028bbf Clean fix issue #19
Isolate and commit fix for issue #19 without potential for regressions.
2013-12-21 00:43:05 +01:00
Stefanos A
e1619a8ad3 Revert "Fix issue #19"
This reverts commit 2c14ec5f80.
2013-12-21 00:41:55 +01:00
Stefanos A.
2c14ec5f80 Fix issue #19
Don't filter window messages passed to our window (see
http://blogs.msdn.com/b/oldnewthing/archive/2005/02/09/369804.aspx).
Additionally, return the correct values for all messages we are actually
handling and clean up unmanaged memory after we are done with the
window.
2013-12-20 23:31:42 +01:00
Stefanos A.
b941a8f06b Explicitly set WindowProcedure calling convention 2013-12-20 23:29:47 +01:00
Stefanos A.
2ddd555aaf Simplify ProcessEvents implementation
Instead of combining PeekMessage+GetMessage, we can simply call
PeekMessage(Remove) to achieve the same effect. This also allows us to
remove the IsIdle property, which is no longer used anywhere.
2013-12-20 08:42:36 +01:00
Stefanos A.
a251617e9b Threads with message pump require STA comparment
May affect issue #19
2013-12-19 10:39:36 +01:00
Stefanos A.
93e7b896c2 Replace Wgl.GetCurrentDC with cached dc
with
2013-12-18 14:51:00 +01:00
Stefanos A.
d8a4ca1162 Cleaned up temporary context construction
The temporary context is now retained until the actual context has been
constructed. If we don't do this, then WGL_ARB_create_context may fail
to work correctly on specific GPUs (e.g. Intel). This may affect issue
#19.
2013-12-18 14:29:06 +01:00
Stefanos A.
a57b4c4270 Fixed GetModesARB implementation
The correct way to query number of available pixel formats is to use
Wgl.Arb.GetPixelFormatAttrib(NumberPixelFormatsArb), not
Wgl.Arb.ChoosePixelFormats. This fixes an issue where Intel drivers
would fail to report any pixel formats in GetModesARB, even when
WGL_ARB_pixel_format is supported.
2013-12-18 14:16:49 +01:00
Stefanos A.
fb93f2af93 Minor code cleanup 2013-12-17 23:31:04 +01:00
Stefanos A.
44b8a9dbdc Use gdi32 implementations of functions
Several functions are defined in both gdi32 and opengl32. Using the
opengl32/wgl versions did not appear to help with issue #19. Let's use
the gdi32 version instead, as suggested here:
https://www.opengl.org/wiki/Platform_specifics:_Windows#The_WGL_functions
2013-12-17 22:35:30 +01:00
Stefanos A.
dd31b41f08 Load opengl32.dll before gdi32.dll
According to
http://stackoverflow.com/questions/199016/wglcreatecontext-in-c-sharp-failing-but-not-in-managed-c,
opengl32.dll must be loaded before gdi32.dll. Affect issue #19.
2013-12-17 21:24:25 +01:00
Stefanos A.
f4f793a5d3 Minor code cleanup
No need to wrap Wgl.DescribePixelFormat, just call it directly.
2013-12-17 16:40:15 +01:00
Stefanos A.
9129e62343 Use opengl32 instead of gdi32 throughout
Since we are dynamically loading opengl32.dll, we are supposed to use
the wgl version of functions that exist in both opengl32 and gdi32 dlls.
2013-12-17 16:39:45 +01:00
Stefanos A.
9c2db338e9 Corrected the entrypoint for wglChoosePixelFormat 2013-12-17 16:38:56 +01:00
Stefanos A.
f4360beb74 Use 16bit depth in GraphicsMode.Default
16bits appear to be better supported than 24bits on virtual machines.
2013-12-16 10:44:37 +01:00
Stefanos A.
3c6682e080 GraphicsContext cannot be released by finalizer
On many/most platforms, GraphicsContexts can only be released by the
thread where they are current. This means that the user must call
GraphicsContext.Dispose() or risk a resource leak.

Since we cannot release contexts on the finalizer thread, we should keep
strong references, instead of weak references, until the user explicitly
calls Dispose().

This patch fixes issues with SDL2 crashing when running the MonoGame
WindowsGL test suite.
2013-12-16 10:43:56 +01:00
Stefanos A.
498f16c2bd Improved diagnostics
This helps when tracking down GraphicsContext-related issues in SDL2.
2013-12-16 10:39:54 +01:00
Stefanos A.
6ad91dcc5b Added hack for MonoGame compatibility
MonoGame uses reflection to access internal APIs. We need to keep these
available until this is fixed downstream.
2013-12-16 10:39:11 +01:00
Stefanos A.
1392d48ec0 Protect against recursion in Closing event
Misbehaving clients that shall not be named here may call
GameWindow.Close() inside the GameWindow.Closing event. This causes
recursion in SDL2, crashing the application.

This patch adds a guard to protect against recursion when calling
GameWindow.Close().
2013-12-16 10:37:59 +01:00
Stefanos A
39a216f1ac Added overloads for compatibility with svn r3127
Several projects are still using the last svn revision from the
sourceforge repository (r3127). These overloads provide an upgrade path
from r3127 to OpenTK 1.1.
2013-12-16 01:55:05 +01:00
Stefanos A
6e110cb820 Normalized xml doc file paths 2013-12-15 23:24:17 +01:00
Stefanos A
a46f895cda Fixed build in Nsis configuration 2013-12-15 22:33:28 +01:00
Stefanos A
78acd27c4c Updated OpenGL documentation to Khronos r24522 2013-12-15 22:32:32 +01:00
Stefanos A
14d815dc8b Fixed deprecation warning 2013-12-15 22:02:32 +01:00
Stefanos A
0db58e36bc Eliminated cls-compliance warnings in BlittableValueType 2013-12-15 22:02:21 +01:00
Stefanos A
f579d0fd81 Eliminated cls-compliance warnings in the math library 2013-12-15 22:02:08 +01:00
Stefanos A
aeb7a72d79 Eliminated CLS-compliance warnings in the bindings 2013-12-15 22:01:45 +01:00
Stefanos A
e9f54dc61e Fixed memory corruption on string return type marshaling 2013-12-15 20:57:25 +01:00
parallels
b31e0e8474 Compatibility fixes for Mono 2.10
The Mono 2.10 compiler fails when compiling extern methods that are not
marked as DllImport. We fix that by adding a method body that throws a
NotImplementedException instead.

Additionally, MonoDevelop 2.8 cannot open sln files with ToolsVersion 12.
The fix is to change ToolsVersion to 11.
2013-12-15 18:27:24 +01:00
Stefanos A
d0e52f6de7 Maintain backwards compatibility with 1.1 2013-12-15 16:58:33 +01:00
Stefanos A
dfd683ef49 Merge master into no-reflect 2013-12-15 16:36:37 +01:00
Stefanos A
5b48564ec2 Ignore missing comments warning
The OpenGL manpages do not include extension methods. Ignore this
warning to let more important ones shine through.
2013-12-06 19:33:03 +01:00
Stefanos A
1d26917758 Updated license information 2013-12-06 09:23:56 +01:00
Stefanos A
f1e93005b9 Added methods for 1.0 compatibility 2013-12-06 09:23:43 +01:00
Stefanos A.
a4f59f7384 Split binaries for library and supporting tools
Tools now go to the Binaries/Tools/[Debug|Release] directory. OpenTK
remains at BInaries/OpenTK/[Debug|Release].

Mono.Cecil and IKVM now reside under the Dependencies/managed/
directory.
2013-12-05 18:43:47 +01:00
Stefanos A
0bdb871e90 Merge remote-tracking branch 'origin/master' into no-reflect 2013-12-05 14:53:37 +01:00
Stefanos A
ca5a5b4d16 Reduce temporary string allocations
Instead of modifying the name of an OpenGL symbol on the managed side,
before copying it to the unmanaged side, we perform the modification
directly on the unmanaged side. This reduces the total amount of
allocations in OpenTK by ~30% (673496 bytes in 10750 objects compared
to 930272 bytes in 15243 objects before this modification.)
2013-12-05 11:20:58 +01:00
Stefanos A.
455a02299e Updated project files
Generate debug symbols on release builds. Remove unused resx file that
referenced WinForms.
2013-12-05 09:03:12 +01:00
Stefanos A
e59405dab3 Implemented manual marshaling of string parameters 2013-12-04 22:32:56 +01:00
Stefanos A
e2801c8c6c Convert string[] callsites to IntPtr
This fixes the signature mismatch between the new marshaling code and
the callsites.
2013-12-04 21:22:33 +01:00
Stefanos A
f15c9ecb95 Implemented marshaling for string arrays
This allows functions such as GL.ShaderSource to run on Mono without
crashing.
2013-12-04 20:33:19 +01:00
Stefanos A
406de0b846 Regenerated bindings 2013-12-03 09:10:45 +01:00
Stefanos A.
58ab194ba8 Fixed centering for non DPI-aware applications 2013-12-02 23:37:22 +01:00
Stefanos A.
c480911843 DPI-scaling should affect resolution
The correct resolution will now be reported depending on whether the
application is DPI-aware.
2013-12-02 23:37:00 +01:00
Stefanos A.
d215075bff High-resolution mode is enabled by default 2013-12-02 22:34:39 +01:00
Stefanos A.
1475b3d427 Made DPI-awareness configurable (issue #6)
It is now possible to indicate that an application is not DPI-aware. In
that case, OpenTK will let the operating system handle DPI scaling. This
results in worse visuals (pixel doubling) but allows non DPI-aware
applications to continue working.
2013-12-02 22:18:16 +01:00
Stefanos A
48efbed1e3 Added MonoDevelop project policy 2013-12-02 12:00:11 +01:00
Stefanos A
45cdc2c1cd Added manual marshaling for StringBuilder
Mono fails to marshal StringBuilder arguments in unmanaged callsites
invoked through calli. We need to implement the marshaling code
ourselves.
2013-12-02 11:58:41 +01:00
Stefanos A
438f83c8d9 Mark slots with [DllImport]; remove "core" and "delegates" generation
We should be able to use static pinvokes on platforms that do not
provide or require extensions and calli instructions on platforms with
extension APIs. This dinstiction will be implemented as a parameter in
the rewriter.
2013-12-01 21:17:15 +01:00
Stefanos A
d6bf7c0d78 Regenerated bindings 2013-12-01 18:28:25 +01:00
Stefanos A.
c6d59b1f29 Removed deleted file from project 2013-11-28 23:23:03 +01:00
Stefanos A.
0a39143b3e Removed unused WGL methods
WGL was autogenerated a few years ago but never touched after that.
Since we use a tiny fraction of all available methods, it makes sense to
remove the unused ones. This reduces dll size and improves startup
times.
2013-11-28 23:22:35 +01:00
Stefanos A.
c53c0bc66f Added GetProcAddress(IntPtr) overloads
This might allow us to improve startup performance, by avoiding string
marshaling during extension loading.
2013-11-28 23:21:19 +01:00
Stefanos A.
8b8ea714ee Fixed wglGetProcAddress entry point
A typo would cause extension loading to fail. This is now fixed.
2013-11-28 09:04:08 +01:00
Stefanos A.
7775fa64aa Removed unused WGL bindings
Our WGL bindings contained dozens of methods that OpenTK did not use.
Removing these reduces the dll size and improves startup times.
2013-11-27 19:37:59 +01:00
Stefanos A.
9c7e5201db Fixed entry point validity check 2013-11-27 19:36:42 +01:00
Stefanos A.
c369bfc75e Use [AutoGenerated] only for generated methods
The rewriter will patch the body of methods marked with [AutoGenerated].
Methods that are implemented manually (e.g. various math helper
overloads) should avoid this attribute.
2013-11-27 08:27:52 +01:00
Stefanos A
ac65eb7b09 Added MonoDevelop artifacts 2013-11-27 00:05:26 +01:00
Stefanos A
da4de365e8 Regenerated bindings 2013-11-27 00:03:21 +01:00
Stefanos A
bb7980b6a9 Update to latest version from git 2013-11-26 19:07:01 +01:00
Stefanos A
4149cdfa88 Do not emit method bodies. 2013-11-26 01:31:29 +01:00
Stefanos A
40f992b5bd Rewrite support for [Slot] attribute 2013-11-26 01:31:10 +01:00
Stefanos A.
84a1e5a739 Initial work on Pin<> statements (WIP) 2013-11-25 20:00:22 +01:00
Stefanos A
997f390ec1 Corrected keyfile path 2013-11-25 08:53:44 +01:00
Stefanos A.
442f8b6131 Added rewrite postbuild event 2013-11-25 00:58:39 +01:00
Stefanos A.
e65f206554 Fixed core loading on Windows
On Windows, entry points for OpenGL 1.0 and 1.1 are not exposed by
wglGetProcAddress. We fall back to LoadLibrary+GetProcAddress when
wglProcAddress fails.
2013-11-25 00:26:20 +01:00
Stefanos A.
0434f623e1 Added InteropHelper file 2013-11-25 00:20:22 +01:00
Stefanos A.
74159da199 Regenerated bindings 2013-11-25 00:19:18 +01:00
Stefanos A.
1e6a819b07 Removed GLObsolete.cs helper
This file must be recreated using the new loading mechanism.
2013-11-24 13:59:15 +01:00
Stefanos A.
811b04e880 Regenerated bindings with new loading mechanism 2013-11-24 13:58:54 +01:00
Stefanos A.
fec958c8dc Hooked up new loading mechanism 2013-11-24 13:58:30 +01:00
Stefanos A.
657c447737 Hooked up new loading mechanism 2013-11-24 13:58:12 +01:00
Stefanos A.
825ed3621f Implemented new loading mechanism 2013-11-24 13:57:43 +01:00
Stefanos A.
7a57c9c3d2 Clarified GetAddress documentation 2013-11-24 13:57:23 +01:00
Stefanos A.
475e7ea797 Allow overriding of loading methods 2013-11-24 13:57:08 +01:00
Stefanos A.
1e71ca9122 Removed delegates and DllImports 2013-11-24 13:56:35 +01:00
Stefanos A
8ee2152709 Moved delegate loaders to the Delegates class 2013-11-23 17:23:26 +01:00
Stefanos A
03a26ed12f Regenerated bindings with lazy loading 2013-11-22 20:07:01 +01:00
Stefanos A
5d0e7a4acf Moved GetExtensionDelegate to the correct position 2013-11-22 20:06:28 +01:00
Stefanos A
ffe934fa5d Added static GetExtensionDelegate implementation 2013-11-22 20:06:04 +01:00
Elias Holzer
6ee04b2ff9 Implemented KeyPress event for Sdl2NativeWindow. 2013-11-22 18:05:11 +01:00
Elias Holzer
f851d8887c Implemented KeyDown and KeyUp events for Sdl2NativeWindow. 2013-11-22 18:04:53 +01:00
Elias Holzer
38532804ec Enabled KeyDown and KeyUp events in NativeWindow. 2013-11-22 18:03:17 +01:00
Stefanos A
2ace001203 Implemented direct binding loading
OpenTK normally uses reflection to load bindings, instead of generating
huge constructors. Although reflection is faster on first load (thanks
to reduced JIT overhead), it fails to work correctly with monolinker.
This branch explores the performance of a direct binding.
2013-11-22 17:32:17 +01:00
Stefanos A.
e2404d2cfc Fix "CursorVisible bugs"
When we enter the modal resize loop on Windows with ClipCursor set, we
cause a feedback loop where every resize causes the cursor to move and
every move causes a new resize. To fix this, we need to ungrab the
cursor when we are enter the modal loop.
2013-11-22 14:10:21 +01:00
Stefanos A.
b7af883cff Fix exceptions on reused OpenGL context handles
Implementations may reuse OpenGL context handles that have been
destroyed. If a context is finalized but not Disposed, then OpenTK may
keep a reference to the old context handle, causing a crash when the
same handle is returned for a new context. To fix that, new context
handles will now replace old handles in case of a clash.
2013-11-21 09:34:06 +01:00
Stefanos A.
08701d318c Destroy SDL window when finalized
SDL_DestroyWindow must be called on the main thread. If the window is
finalized, the finalizer will push a CLOSE event to the event loop
(thread-safe) and the window will be destroyed on the main thread.
2013-11-21 09:31:32 +01:00
Stefanos A.
75d4f3d07c Fixed #5
We need to release the cursor before closing a GameWindow, otherwise
subsequent GameWindows may fail to receive mouse events.
2013-11-20 18:05:45 +01:00
Stefanos A.
486130c01e Toolkit.Init() now returns a concrete class
This gives us room for expansion in the future, if necessary.
2013-11-20 13:12:42 +01:00
Stefanos A.
1d19a80b53 Removed incorrect comment 2013-11-20 13:05:49 +01:00
Stefanos A.
48803bb4d6 Fixed #4
Sdl2InputDriver.Dispose() would call SDL_DelEventWatch with a different
"user_data" parameter than SDL_AdEventWatch. This caused the EventFilter
to remain registered and subsequently crash when closing and reopening a
window.
2013-11-20 09:10:12 +01:00
Stefanos A
255f4e9083 Completed compatibility overloads for OpenTK 1.0 2013-11-20 08:16:07 +01:00
Stefanos A
02120f429f Do not trim 's' from Groups 2013-11-20 08:16:06 +01:00
Stefanos A.
8c5887e996 Aligned GL core and compat enums 2013-11-18 18:51:38 +01:00
Stefanos A.
32828ecd8a Do not call SDL.GetVersion unless requested 2013-11-18 18:35:23 +01:00
Stefanos A
ac0fab7760 More compatibility overloads for OpenGL 2013-11-18 18:32:36 +01:00
Stefanos A.
e7f70330b2 Implemented IEquatable<ColorFormat>
This eliminates memory allocations when storing and comparing
ColorFormat structures.
2013-11-18 13:49:06 +01:00
Stefanos A
3d50554903 Added OpenGL overloads for OpenTK-1.0 compatibility 2013-11-18 13:28:44 +01:00
Stefanos A
e572f418af Added compatibility overloads for ES 2.0 2013-11-18 01:10:01 +01:00
Stefanos A
01d40c551a Aligned FBO API with desktop OpenGL 2013-11-17 23:57:38 +01:00
Stefanos A
358bcd4f88 Regenerated bindings 2013-11-17 01:49:10 +01:00
Stefanos A
f9deeaead7 Improved compatibility with OpenTK 1.0
Added overloads for enumerations with name changes. Reduced differences
between ES and GL APIs.
2013-11-15 01:59:50 +01:00
Stefanos A
431202d830 Corrected convenience wrappers for Get* and Delete*
GetBoolean, GetInteger6, GetFixedvOES and Delete* are now matched in
the convenience wrapper generator. Methods returning vectors of fixed
size (e.g. 4 ints) are no longer matched.
2013-11-14 17:40:06 +01:00
Stefanos A.
0ee72856e4 Added workaround for wglMakeCurrent error 6
On some drivers and virtual machines, wglMakeCurrent may fail with a
code 6 when first called. The suggested workaround is to call it in a
loop until it succeeds. See
https://www.opengl.org/discussion_boards/showthread.php/171058-nVidia-wglMakeCurrent()-multiple-threads
2013-11-14 17:37:39 +01:00
Stefanos A
4fd6347de7 Mark untyped overloads as obsolete 2013-11-14 14:10:19 +01:00
Stefanos A
b975eccd45 Regenerated bindings 2013-11-14 11:35:32 +01:00
Stefanos A.
21069ee34c Do not scale in normal-dpi modes 2013-11-14 09:25:53 +01:00
Stefanos A.
7c8cc5f746 Scale window size on hi-dpi mode
Follow high-dpi guidelines for scaling a window on high-dpi modes.
2013-11-14 09:02:47 +01:00
Stefanos A.
94e2649704 Cleaned up context profile selection
Added support for WGL_create_context profiles and added methods for the
selection of context flags and profile.
2013-11-14 08:30:11 +01:00
Stefanos A.
803c575201 Corrected core profile selection
According to GLX_create_context, the correct flag for a core profile is
GLX_CONTEXT_CORE_PROFILE_BIT_ARB.
2013-11-14 08:29:06 +01:00
Stefanos A.
f142dbdfc3 Improved WinGLContext initialization
Cleaned up and added debugging information to the temporary context
construction in WinGLContext. Simplified WinGraphicsMode constructor.
2013-11-14 08:05:08 +01:00
Stefanos A.
5d6ca5c7da Added GetDeviceCaps (windows platform)
We will use this method to read out the logical DPI of the monitor and
scale window elements accordingly.
2013-11-14 01:43:40 +01:00
Stefanos A.
f9fdddea64 Re-added WindowHandle property
There are projects that use reflection to access
*WindowInfo.WindowHandle directly. This change ensures we don't break
them.
2013-11-13 18:25:49 +01:00
thefiddler
1792f7bf29 Added Version20 overload to StencilFuncSeparate
Compatibility fix for OpenTK 1.0
2013-11-12 23:39:43 +01:00
Stefanos A.
b9fcf7c3c3 Cleaner startup sequence
OpenTK.Toolkit will now initialize OpenTK.Configuration and
OpenTK.Platform.Factory explicitly. It can also receive an optional
ToolkitOptions parameter to influence the OpenTK.Platform implementation
that will be chosen. Finally, it explicitly implements IDisposable to
clean up after itself.
2013-11-12 20:34:53 +01:00
Stefanos A.
663864f083 Refactored environment config detection
This significantly cleans up the startup sequence on all platforms:
- X11 is not detected on non-Linux platforms unless the user explicitly
requests it
- Supports selection of platform abstractions (SDL) vs native
implementations.
- Returns correct flags on Android and iOS.

This contains a semantic change: OpenTK.Configuration will not return
correct values until OpenTK.Toolkit.Init() has been called, either
directly or indirectly (e.g. by creating a window.)
2013-11-12 20:32:31 +01:00
Stefanos A.
7503a87b3f Added ToolkitOptions class
ToolkitOptions allows the user to influence the implementation of
OpenTK.Platform at runtime.
2013-11-12 20:22:08 +01:00
Stefanos A
25f3305f3e Merge branch 'modes' 2013-11-11 11:45:15 +01:00
Stefanos A.
0d0f578788 Enabled SAMPLE_BUFFERS EGL attribute
This attribute is required for multisampling support.
2013-11-11 11:42:30 +01:00
thefiddler
8360b7a2ba Generate overloads without strong enums for 1.0 compat
OpenTK 1.0 and Xamarin Android/iOS do not use strongly-typed enums for
OpenGL ES. Generate overloads with the "All" enum in order to maintain
compatibility.
2013-11-11 10:03:24 +01:00
thefiddler
2c9d574b08 Merge branch 'modes' of https://github.com/thefiddler/opentk 2013-11-10 19:11:05 +01:00
Stefanos A.
c66b22a1f3 Updated convenience overloads 2013-11-10 19:04:18 +01:00
Stefanos A.
8003d06315 Move convenience overloads to generator
The generator now handles the creation of convenience overloads. These
must be removed from the helper classes to avoid redefinition errors.
2013-11-10 15:36:53 +01:00
Stefanos A.
11c1071625 Corrected declarations in convenience overloads 2013-11-10 10:08:04 +01:00
Stefanos A.
089c108ea0 Corrected indentation 2013-11-10 09:20:54 +01:00
Stefanos A.
5aad11f6ee Generate bindings for testing (WIP2) 2013-11-10 09:18:15 +01:00
Stefanos A.
06ad3bf1dc Generate bindings for testing (WIP) 2013-11-10 09:14:30 +01:00
Stefanos A
dc093f8fa9 Added mapping for libXi
On Debian-based distributions, libXi.so does not exist. We have to lookup libXi.so.6 instead.
2013-11-09 18:55:35 +01:00
Stefanos A
b08e59e861 Allow non-realized GraphicsMode
It is now possible to pass a non-realized GraphicsMode to the X11GLContext and X11GLNative constructors. A non-realized GraphicsMode is a GraphicsMode with a null Index (i.e. which has not passed through SelectGraphicsMode()).
2013-11-09 18:55:17 +01:00
parallels
62d6791736 Use glXGetProcAddressARB
According to the Linux OpenGL ABI, glXGetProcAddressARB must be statically exported by libGL. This does *not* hold true for glXGetProcAddress. We must used the ARB version instead.
Furthermore, glx entry points, unlike wgl, do not depend on any specific OpenGL context. This means we can load them in the constructor of the Glx class.
2013-11-09 18:50:53 +01:00
parallels
7f921dae47 Merge branch 'master' of https://github.com/thefiddler/opentk into modes 2013-11-09 17:15:05 +01:00
parallels
da684d233e Swallow DllNotFoundException in Sdl2 constructor 2013-11-09 17:13:24 +01:00
Stefanos A
95316829ec Updated WGL init sequence
WinGraphicsMode no longer creates a temporary context in order to create
the list of available modes. Instead, it requires to be passed an
existing context in its constructor.

WinGLContext now creates one temporary context in its static constructor
and hands that to WinGraphicsMode.

WinFactory no longer supports the CreateGraphicsMode API. This API will
be removed in the future, because the link because contexts and modes
cannot be separated in the general case.
2013-11-09 15:07:19 +01:00
Stefanos A
0f01a6d128 Stronger check for ES support
It is not enough to check for EGL, we also need to check that
ContextProfileFlags.ES is set.
2013-11-09 15:07:18 +01:00
Stefanos A
ec2c64ee15 Remove static init of GetCurrentContext
The static initializer of GetCurrentContext would always default to the
desktop PlatformFactory, which caused problems when trying to run OpenGL
ES code on the desktop. The initializer is now removed and
GetCurrentContext is set in the context constructor, before creating any
contexts.
2013-11-09 15:07:17 +01:00
Stefanos A
440e3fe248 Load ES30 and OpenGL4 entry points 2013-11-09 15:07:16 +01:00
Stefanos A
2725b3cd08 Fix support for 3.2+ contexts (issue 3111)
glXGetProcAddress may return a non-null value even if a function is not
supported by the server. We need to check the extension string using
any GLX extensions. Fixes issue http://www.opentk.com/node/3111 "GLX
extension support is not checked correctly".

Furthermore, mode selection is now performed explicitly by the
X11GLContext constructor.
2013-11-09 11:16:14 +01:00
Stefanos A
3c71634667 Temp context not necessary for GLX
GLX entry points are not bound to a specific context. This means that, unlike WGL, GLX does not require a temporary context in order to load its entry points!
2013-11-09 11:07:37 +01:00
Stefanos A
6edaf8c3cf Deduplicate MacOSGraphicsMode and AglContext
The IGraphicsMode interface is gradually being removed and the
MacOSFactory will now throw an exception if an instance is requested.
AglContext no longer duplicates MacOSGraphicsMode functionality.
2013-11-08 18:44:02 +01:00
Stefanos A
f77a6b11c3 SDL_GL_GetAttribute requires a valid context
Calling SDL_GL_GetAttribute when context construction has failed leads
to erroneous behavior. This call should only be made when a context has
been constructed correctly.
2013-11-08 17:31:54 +01:00
Stefanos A
5b5a395bbd Merge branch 'master' of https://github.com/thefiddler/opentk into modes 2013-11-08 16:41:20 +01:00
Stefanos A
49df5ff453 Do not generate delegates for overloads
We should only generate delegates for actual OpenGL entry points, not
for overloaded functions that resolve to the same entry point. This
improves loading speeds and reduces the size of the compiled dll.
2013-11-08 16:40:43 +01:00
Stefanos A
5a2fc1e411 Added missing doc comment 2013-11-08 15:33:41 +01:00
Stefanos A
e0ffd9b42d More sane Sdl2Factory.CreateGetCurrentContext() implementation 2013-11-08 15:26:52 +01:00
Stefanos A
29fe1052de Added SDL_GL_GetCurrentContext method and TouchMouseID constant.
SDL_GL_GetCurrentContext will allow us to replace the weird
implementation in Sdl2Factory.CreateGetCurrentGraphicsContext()
and the latter to disable mouse emulation if we wish to.
Conflicts:
	Source/OpenTK/Platform/SDL2/Sdl2.cs
2013-11-08 15:25:42 +01:00
Stefanos A
eba7e59253 Fixed ES rendering. 2013-11-08 10:56:45 +01:00
Stefanos A
28fa768257 Fixed platform detection for Android
Conflicts:
	Source/OpenTK/Configuration.cs
2013-11-08 10:54:50 +01:00
Stefanos A.
a51540e8d9 Updated WGL init sequence
WinGraphicsMode no longer creates a temporary context in order to create
the list of available modes. Instead, it requires to be passed an
existing context in its constructor.

WinGLContext now creates one temporary context in its static constructor
and hands that to WinGraphicsMode.

WinFactory no longer supports the CreateGraphicsMode API. This API will
be removed in the future, because the link because contexts and modes
cannot be separated in the general case.
2013-11-08 10:46:27 +01:00
Stefanos A.
c9b905d235 Stronger check for ES support
It is not enough to check for EGL, we also need to check that
ContextProfileFlags.ES is set.
2013-11-08 10:42:48 +01:00
Stefanos A.
2cd91bd0a0 Remove static init of GetCurrentContext
The static initializer of GetCurrentContext would always default to the
desktop PlatformFactory, which caused problems when trying to run OpenGL
ES code on the desktop. The initializer is now removed and
GetCurrentContext is set in the context constructor, before creating any
contexts.
2013-11-08 10:41:58 +01:00
Stefanos A.
a12b394607 Load ES30 and OpenGL4 entry points 2013-11-08 10:39:08 +01:00
Stefanos A.
03c04fd308 Workaround for issues #4 and #6
GraphicsMode.Default used to be set to
(DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 0, 2, false) for improved
compatibility with older systems. However, this appears to be causing
issues with specific modern GPUs. Switch the default mode to (32, 24, 8)
until a more proper solution can be found.
2013-11-07 18:42:17 +01:00
Stefanos A
b6610001ea Merged ES 2.0 extension tokens to ES 3.0
By adding ES 2.0 extensions tokens to ES 3.0, we have a very
straightforward update path to move an application from the older API
to the newer.
2013-11-07 16:54:39 +01:00
Stefanos A
be8f7c6311 Corrected ES 2.0 enums
After the previous commit, several ES 2.0 functions would refer to
enums found in ES 3.0. These enums have been copied to ES 2.0, either
as core enums or as extensions.
2013-11-07 16:25:19 +01:00
Stefanos A
735d05e496 Merged ES2.0 and ES3.0 replacements
ES 3.0 includes ES 2.0 verbatim. We can significantly reduce
duplication by using the same <replace> node for both APIs. Note that
the enumerations must remain separate, as ES 2.0 and 3.0 support
different tokens.
2013-11-07 11:37:51 +01:00
Stefanos A
7c54a19708 ES 3.0 fixed enums for GetIntegeri_v and GetInteger64i_v
These functions have a first parameter named "target", not "pname".
Fixed now.
2013-11-07 10:58:02 +01:00
Stefanos A
e59c95f2f9 ES 3.0 fixed enums for GetInteger64*
GetInteger64v should accept GetPName, while GetInteger64i_v should
accept GetIndexedPName.
2013-11-07 10:39:20 +01:00
Stefanos A
8de24c97fb ES 3.0 strong enums for DrawBuffersEXT and NV
Relax the extension constraint in DrawBuffers, in order to add strong
enums to the extension varieties of this function.
2013-11-07 10:33:02 +01:00
Stefanos A
2d1df46d98 ES 3.0 strong enums for DrawArrays*() and Draw*Elements*()
The strongly-typed enums include core and extension varieties.
2013-11-07 10:17:33 +01:00
Stefanos A
0002b2e23e Fixed typo in ES3Generator.cs
The DllImports file should be named ES30Core.cs, not ES3Core.cs. Fixed
now.
2013-11-07 10:09:17 +01:00
Stefanos A
0f98f0e00b Fixed misspelled and missing enums 2013-11-07 09:47:27 +01:00
Stefanos A
93b8d4b86e Fixed enums for (Get)ObjectLabel
ObjectLabel and GetObjectLabel are part of KHR_debug.
2013-11-07 09:34:48 +01:00
Stefanos A
0598e02140 Fixed enums for GetDebugMessageLog
GetDebugMessageLog was misspelled as GetMessageDebugLog. This is now
fixed.
2013-11-07 08:39:57 +01:00
Stefanos A
de38df8820 Fixed strong-enums for GetDebugMessageLog
GetDebugMessageLog is part of KHR_debug.
2013-11-07 08:36:23 +01:00
Stefanos A
a2f2ab29ea Fixes for ES 3.0 strongly-typed enums
Fixed parameter mismatches in CopyBufferSubData and BlendFuncSeparate.
Implemented KHR_debug extension.
2013-11-07 08:33:17 +01:00
Stefanos A
2f3d79d464 Merge branch 'master' of https://github.com/thefiddler/opentk 2013-11-07 08:15:18 +01:00
Stefanos A
2b4d10ffd7 Strongly-typed enums for ES 3.0 (complete)
Implemented sectiosn: Pixel Rectangles. Binding & Managing Framebuffer
Objects, Renderbuffer Objects, Attaching Renderbuffer Images to
Framebuffer, Attaching Texture Images to Framebuffer, Framebuffer
Completeness, Invaildating Framebuffer Contents, Renderbuffer Object
Queries, Simple Queries, String Queries.
2013-11-07 08:14:49 +01:00
Stefanos A.
62c9793a6e Fixed number of buffers
ContextAttribute.DOUBLEBUFFER is a boolean in SDL (false->single
buffering, true->double buffering). We need to adjust the number of
buffers accordingly (single buffering->1 buffer, double buffering->2
buffers).
2013-11-06 01:04:59 +01:00
Stefanos A
21a1ca8895 Switch to EnumDisplayModesEx
Use EnumDisplayModesEx instead of EnumDisplayModes. This might help
with issue #6.
2013-11-05 23:41:42 +01:00
Stefanos A
a4f125f16e Added workaround for issue #6
The issue is that some display devices report a BitsPerPel value of 0.
It is not clear whether this is a bug in WinDisplayDevice.cs or some
strange windows issue. The implemented workaround adds an entry to the
debug log and hardcodes BitsPerPel to 32 whenever this condition is
encountered. More investigation required.
2013-11-05 23:21:49 +01:00
Stefanos A
1a02457ddc Strongly-typed enums for ES 3.0 (WIP8)
Implemented sections: Hints and Sync Object Quries.
Renamed SyncParameter to SyncParameterName, as per the OpenGL naming
conventions.
2013-11-05 10:23:25 +01:00
Stefanos A
167c97dd84 Strongly-typed enums for ES 3.0 (WIP7)
Implemented section: Sync Objects and Fences [5.2].
Fixed desktop OpenGL wrapper for ClientWaitSync and FenceSync.
2013-11-05 09:53:34 +01:00
Stefanos A
ad1755f58e Moved overload to overrides.xml
Overloads for backwards compatibility should now be placed in an
<overload> element inside overrides.xml.
2013-11-05 09:44:20 +01:00
Stefanos A
2511cb1086 Implemented support for <overload> element
The <overload> element simplifies the addition of overloads for
backwards compatibility. It is defined similar to the <replace>
element, but instead of replacing the parameters of a function
in-place, it adds a new overload and modifies the overload instead.
2013-11-05 08:55:52 +01:00
Stefanos A
25b9939263 Strongly-typed enums for ES 3.0 (WIP6)
Implemented strongly-typed enums for sections: Selecting a Buffer for
Writing, Fine Control of Buffer Updates, Clearing the Buffers.
2013-11-04 23:25:02 +01:00
Stefanos A
372dac9c48 Strongly-typed enums for ES 3.0 (WIP5)
Implemented sections: Stencil Test, Depth Buffer Test, Blending.
2013-11-04 23:01:25 +01:00
Stefanos A
dcd2d03e59 Strongly-typed enums for ES 3.0 (WIP4)
Implemented sections: Texture Image Specification, Alternative Texture
Image Specification, Compressed Texture Images, Texture Parameters,
Manual Mipmap Generation and Enumerated Queries.
2013-11-04 22:27:06 +01:00
Stefanos A
20e70062f8 Strongly-typed enums for ES 3.0 (WIP3)
Implemented sections: Texturing, Sampler Objects, Sampler Queries,
Texture Image Specification.
2013-11-04 19:49:25 +01:00
Stefanos A
9b5be9300b Strongly-typed enums for ES 3.0 (WIP2)
Added strongly-typed enums for sections: Vertices, Shaders and
Programs. Added a number of missing enums for ES 2.0. Normalized
several APIs between OpenGL and OpenGL ES.
2013-11-04 00:04:09 +01:00
Stefanos A
af78a01643 Strongly-typed enums for ES 3.0 (WIP)
Implemented strongly-typed enums for sections: Buffer Objects,
Asynchronous Queries, Transform Feedback, ReadingandCopying Pixels and
Rasterization.
2013-11-03 21:30:25 +01:00
Stefanos A
7978627ad4 Merge Delegate.Version
When a Delegate is defined multiple times in the spec, we should check
if any of these definitions contains a proper Delegate.Version and
store that. This improves the self-documentation aspect of the bindings.
2013-11-03 20:41:29 +01:00
Stefanos A
7322828304 Regenerated the bindings using the latest specs 2013-11-03 20:36:22 +01:00
Stefanos A.
6f08995963 Added PrimitiveType <=> BeginMode overloads
Khronos renamed BeginMode to PrimitiveType starting with GL 4.4.
OpenTK now has overloads for both flavors.
2013-11-03 16:11:39 +01:00
Stefanos A
60f971ffed Updated to the latest gl4 specs and docs
Large code-drop from Khronos upstream.
2013-11-03 12:43:50 +01:00
Stefanos A
7c3e29012f Bindings for GL4.4, ES1.1, ES2.0 and ES3.0
The new bindings are based on the fresh gl.xml registry by the Khronos
group.
2013-11-03 12:34:19 +01:00
Stefanos A
f835c63444 Added DebugProc for KHR_debug 2013-11-03 12:33:17 +01:00
Stefanos A.
6c16835d8c Added doc comment on ColorFormat.Empty. 2013-11-03 01:44:31 +01:00
Stefanos A.
0746334ab3 Regenerated bindings with the latest generator
The new bindings have improved enum documentation and fix an issue with
incorrect overloads in wrappers with generic parameters.
2013-11-01 09:29:42 +01:00
Stefanos A.
97ca64121c Made IsFlagsCollection read-write
The decision whether an Enum is a flags collection is now made either by
the spec reader or the enum processor (not the Enum class itself.)
2013-10-27 17:35:36 +01:00
Stefanos A.
2444ccf082 Improve override lookup for extension functions.
Function overrides are now looked up in the following order: specific
name (e.g. ProgramParameteriARB), extensionless name (e.g.
ProgramParameteri) and generic mame (e.g. ProgramParameter). This
improves the override resolution for functions with multiple extension
forms (core, ext, arb, etc).
2013-10-27 02:35:53 +02:00
Stefanos A.
816f1e5c7f Fixed the DebugProc signatures.
The various DebugProc* delegates now conform to their specifications.
2013-10-27 01:32:08 +02:00
Stefanos A.
f57b53b677 Regenerated using latest generator. 2013-10-27 01:31:20 +02:00
Stefanos A.
1a1ef03396 The last parameter of GL.ShaderSource should be an array. 2013-10-25 16:30:50 +02:00
Stefanos A.
65ff060ca5 Corrected the values of the GL_NEXT_BUFFER_NV and
GL_SKIP_COMPONENTS_*_NV extensions.
2013-10-25 16:10:51 +02:00
Stefanos A.
be6c583f4f Implemented Sdl2GraphicsMode.. 2013-10-24 09:32:17 +02:00
Stefanos A
af9d6dd928 Fixed ClearTex[Sub]Image <type> parameter
As per bug #1006 on the public Khronos bugzilla, <type> corresponds to the PixelType accepted by TexImage3D. This is now fixed.
2013-10-24 09:01:59 +02:00
Stefanos A.
192fedbca5 Removed sdl2-cs in favor of a leaner, better-designed binding. 2013-10-24 02:02:35 +02:00
Stefanos A
7aa5499f3e Merge branch 'gl4' of https://github.com/thefiddler/opentk 2013-10-24 01:47:00 +02:00
Stefanos A
80f0569f9a Implemented new, leaner SDL2 binding.
The new binding is based on the SDL2.0.1 RC1 headers.
2013-10-24 01:45:13 +02:00
Stefanos A
d8089a7732 Updated documentation according to the latest GL4 manpages. 2013-10-23 20:19:16 +02:00
Stefanos A.
60afa79203 Updated documentation according to the latest available manpages. 2013-10-23 20:17:08 +02:00
Stefanos A.
eb84a29206 Implemented "Debug Output" and "State and State Requests"
functionality according to the OpenGL 4.4 specification, sections 20
and 22.
2013-10-23 20:12:05 +02:00
Stefanos A.
3037baa5ea Implemented "Reading and Copying Pixels" functionality from the OpenGL
4.4 specification, sections 18.2 and 18.3.
2013-10-23 18:54:34 +02:00
Stefanos A.
b425bff682 Implemented Whole Framebuffer commands according to the OpenGL 4.4
specification, section 17.4.
2013-10-23 11:43:11 +02:00
Stefanos A.
86214ebc77 Implemented per-fragment operations according to the OpenGL 4.4
specification, section 17.
2013-10-23 10:49:29 +02:00
Stefanos A.
1585d6a02e Implemented Vertex Post-Processing according to the OpenGL 4.4
specification, section 13.
2013-10-23 10:23:02 +02:00
Stefanos A.
bb2bf9fa48 Implemented Vertex Attributes according to the OpenGL 4.4
specification, section 11.
2013-10-23 09:43:33 +02:00
Stefanos A.
88183770ae Implemented Vertex Arrays accordign to the OpenGL 4.4 specification,
section 10.
2013-10-23 09:31:09 +02:00
Stefanos A.
35b63e777a Fixed version number on VertexAttribP1 methods (should be 3.3, not
1.2).
2013-10-22 21:10:14 +02:00
Stefanos A.
745fd9974f Implemented strongly-typed Framebuffer and Renderbuffer Objects
according to the OpenGL 4.4 specification, section 9.
2013-10-22 20:52:37 +02:00
Stefanos A.
5a59e63cea Implemented strongly-typed Texture functions according to the OpenGL
4.4 specification, section 8. See issue #2.
2013-10-22 18:37:25 +02:00
Stefanos A.
badb083686 Added SGIX_texture_icc enumeration that has been removed by the
upstream specs. This silences a large amount of warnings caused by the
lack of this extension.
2013-10-22 17:19:19 +02:00
Stefanos A
dc00ea7ea5 Merge branch 'master' of https://github.com/thefiddler/opentk 2013-10-22 16:58:33 +02:00
Stefanos A.
43bde3433a Implemented strong-types for Shader and Program Objects according to
the OpenGL 4.4 specification, section 7.
2013-10-22 16:52:35 +02:00
Stefanos A.
9613975681 Updated strong-types for Buffer Objects according to the OpenGL 4.4
spec, section 6.
2013-10-22 14:40:49 +02:00
Stefanos A.
cfa4f230c5 Updated strong-types for asynchronous queries, query objects and time
queries according to OpenGL 4.4 spec, section 4.2.
2013-10-22 14:00:01 +02:00
Stefanos A.
9685f6e2f0 Array overloads with count=1 should be turned into ref/out parameters.
This fixes an issue where arrays with count=1 would remain as unsafe
pointers instead of becoming ref/out parameters.
2013-10-22 13:41:31 +02:00
Stefanos A.
a23b846800 Updated to the latest 4.3 specs (WIP). 2013-10-22 13:22:22 +02:00
Stefanos A.
c49f9cd4a1 Implemented compatibility overloads for the changes introduced by the
4.3 .spec files.
Added DebugProc definition required in the 4.3 specs.
2013-10-22 11:57:18 +02:00
Stefanos A.
0d3ab7174c Fixed crash on 32-bit machines
uint-to-intptr conversion must obey uint-to-int conversions on 32-bit
machines, otherwise an OverflowException may occur: conversions of
numbers over 2^31-1 must be declared as unchecked.

Fixes issue reported here: http://www.opentk.com/node/3418
2013-10-21 19:41:26 +02:00
thefiddler
4dfcf39d26 Added missing DllImport attribute.
Fixes thefiddler/opentk#1
2013-10-12 19:43:26 +02:00
Stefanos A
915ead34cb Modify dllimport path on Android builds. 2013-10-12 15:17:10 +02:00
Stefanos A
6df11a8564 Fixed incorrect self-assignment statements 2013-10-12 15:16:05 +02:00
Stefanos A
30e42bb6dd [DllImport] registry methods when the Microsoft.Win32 namespace is not
available (untested).
2013-10-12 05:15:46 +02:00
Stefanos A
70818d97e1 Fixed compilation on desktop platforms. 2013-10-12 05:14:51 +02:00
Stefanos A
863edc35d1 Added Xamarin.Android target 2013-10-12 05:08:27 +02:00
Stefanos A
d27904292d System.Drawing is required for Point, Size and Rectangle types. 2013-10-12 05:07:46 +02:00
Stefanos A
1130d988b0 Use OpenTK.Minimal to stub out missing System.Drawing functionality
when building on Android or iOS platforms.
2013-10-12 05:06:54 +02:00
Stefanos A
bb3156d185 Implemented minimal System.Drawing stubs for Xamarin.Android targets. 2013-10-12 04:59:55 +02:00
thefiddler
b64c9d84e7 Why does this file keep changing? 2013-10-11 09:52:53 +02:00
thefiddler
f013c44ba1 Fixed Tilde and Number1 scancodes 2013-10-11 09:51:08 +02:00
thefiddler
8dcb8601a2 Normalized line endings
Hopefully this is the first and last time we have to do this.
2013-10-11 01:58:54 +02:00
Stefanos A
73e3614338 Merge branch 'scancodes'
Conflicts:
	Source/OpenTK/OpenTK.csproj
	Source/OpenTK/Platform/Windows/WinFactory.cs
2013-10-11 01:05:55 +02:00
Stefanos A
5aba35668b Always Set HIDPI flag
It does not to set this flag on previous SDL2 versions, it is ignored silently when not supported.
2013-10-10 00:34:15 +02:00
Stefanos A
459313dca8 Fixed line endings 2013-10-10 00:18:59 +02:00
Stefanos A
fb86334835 HIDPI support requires SDL > 2.0.0
SDL_GL_GetDrawableSize was introduced after 2.0.0, so we need to check for that version before we call this method. Fixes MethodNotFounException on vanilla libsdl2-2.0.0 on linux.
2013-10-07 14:17:42 +03: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
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.
b3a0b78454 Use locale-independent scancodes
This significantly improves the usability of keyboard input, by allowing
a common input scheme to be used on different keyboard layouts. Text
input will be facilitated through a new API.
2013-10-03 20:53:34 +02:00
Stefanos A.
4dceea9e21 Added common key aliases 2013-10-03 20:52:02 +02:00
Stefanos A.
3f81bc26d4 Removed support for < Windows XP
The support burden for Windows versions prior to XP was too large, plus
the relevant code was completely untested. Removing that will allow us
to focus on the things that really matter.
2013-10-03 20:51:36 +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.
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.
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
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
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
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.
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
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
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
Stefanos A.
2666125b24 Implemented WindowState, WindowBorder and Icon
SDL2 suffers many of the issues we encountered when implementing
OpenTK.Platform.Windows. Workarounds are now in place to make
WindowState changes behave reasonably.
2013-09-27 23:01:46 +02:00
Stefanos A.
56d7e4e564 Use OpenGL window flag and switch to "fake" fullscreen mode
The OpenGL flag is required when using SDL2 on Windows. Fake fullscreen
works much better on modern monitors and systems with multiple monitors.
2013-09-27 18:57:05 +02:00
Stefanos A.
5df5447ff9 Add debug message when context creation fails 2013-09-27 18:55:58 +02:00
Stefanos A.
3398902940 Use Wgl.Import.GetCurrentContext DllImport directly
Wgl is implemented using the regular DllImport + delegate approach, in
order to support extensions. The delegates have not been armed at this
point, so we need to use the DllImport directly.

The whole wgl API should be revisited (we are using only a tiny
portion.)
2013-09-27 18:55:38 +02:00
thefiddler
6d0b5eb49f Implemented SDL2 platform using sdl2-cs
This is a new platform that can be used then sdl2 is installed on the target system. SDL2 is commercially supported by Valve and provides better support for MacOS compared to our current implementation (Cocoa vs Carbon). It will also help us introduce faster support for new platforms. Existing platforms remain as a fallback and will be automatically used if sdl2 is not installed.

Please note that this is still a work in progress. The new mouse and keyboard API is not supported yet. Due to limitations of sdl2, multiple mice/keyboards are also not supported.
2013-09-27 14:41:37 +02:00
thefiddler
89845d5ff9 Integrated sdl2-cs bindings for sdl2
This is using the sdl2/pure branch of https://github.com/thefiddler/SDL2-CS.git which contains the SDL2 bindings without MiniTK.
2013-09-27 14:33:52 +02:00
thefiddler
3989b94e68 Merge commit 'ed45dddb98c8250a33505c953b6c60bf7a854ffb' as 'Source/OpenTK/Platform/SDL2/sdl2-cs' 2013-09-27 14:26:50 +02:00
thefiddler
2e1bcaf280 Added support for high-dpi mode on Windows.
The platform factory for windows now calls SetProcessDPIAware
in order to enable support for high-dpi modes. The relevant
DllImport has been added to API.cs
2013-09-26 01:35:59 +02:00
thefiddler
c7e04c6097 Merge remote-tracking branch 'andy/master' 2013-09-26 01:28:58 +02:00
Neil White
fc1a8e022b Fix for setting Matrix/Vector values by Index
Many Matrix*/Vector* implementations were throwing
IndexOutOfBoundsException when you tried to set their values via their
indexer due to a missing else statement.
2013-09-24 15:46:34 +01:00
David Jeske
cce40d60b0 fix MacOS bug mapping modifier keys to the scancode array 2013-08-10 19:50:05 -07:00
David Jeske
2c29df6296 added support for smooth trackpad scrolling on macos 2013-08-09 23:20:49 -07:00
Robert Rouhani
5c66266933 Added Quaterniond version of FromMatrix 2013-07-18 13:14:30 -07:00
Robert Rouhani
d479e3768b Added Quaternion.FromMatrix
Added a Diagonal and Trace property to all matrices
Added missing doc comments in the matrix classes to reduce the number of compiler warnings
2013-07-18 12:58:43 -07:00
Andy Korth
f38e717601 Fix for github issue 13, terrible crash on Keyboard GetState 2013-06-04 16:02:37 -05:00
zastrowm
e7ba5e789f Update whitespace issues to conform to the rest of the document 2013-04-26 21:09:12 -05:00
zastrowm
5f336dd9f9 Change WinRawMouse.ProcessMouseEvents to call code directly instead of using lambdas
Change WinRawMouse.ProcessMouseEvents to call code directly instead of using lambdas.  The lambdas caused memory allocations and were unneeded
2013-04-26 21:06:08 -05:00
Andy Korth
29c7d96420 Merge pull request #10 from Artfunkel/master
Matrix ExtractScale() bug fix and "Clear" methods
2013-04-15 07:52:49 -07:00
Tom Edwards
b38c81a458 Added Matrix clearing methods
- Added ClearTranslation(), ClearScale(), ClearRotation() and
ClearProjection()
- Added ExtractProjection() to Matrix4
- Fixed ExtractScale() giving incorrect results if a Matrix4 contained
projection data
- Added setters to Matrix4d's Column properties
2013-04-11 22:23:43 +01:00
Dean Ellis
9a39949249 Merge pull request #1 from elisee/fix-client-rectangle-setter
Fix ClientRectangle setter on Windows (WinGL) & Linux (X11)
2013-03-22 16:29:36 -05:00
Tom Edwards
ca7e2c9c4b Copied Matrix4 changes to other classes
* Removed  pointless LengthSquared check from ExtractRotation()
* Improved inline documentation
2013-03-20 12:44:12 +00:00
Tom Edwards
498b659d58 Changes suggested by Rob Rouhani
* Turned the new Matrix4 properties into methods
* Matrix4.Normalize() now behaves correctly. ExtractRotation() does its
own row normalisation.
2013-03-19 15:28:31 +00:00
Tom Edwards
b20b21d228 A couple more maths functions 2013-02-23 18:26:34 +00:00
Tom Edwards
11114ca4ea Extra maths features
- Added TranslationPart, ScalePart and RotationPart properties to
Matrix4
- Added Normalized() to Vector2/3/4, Quaternion and Matrix
2013-02-18 18:46:26 +00:00
Tom Edwards
6c35e8ef24 Merge remote-tracking branch 'origin/ScanCodeKeyboardBranch' 2013-02-17 14:58:16 +00:00
Andy Korth
ebb56e9d77 minor notes in comments of Matrix classes 2013-01-31 09:58:49 -06:00
Robert Rouhani
920d683954 Merge branch 'master' of github.com:andykorth/opentk
Conflicts:
	Source/OpenTK/Math/Matrix3.cs
	Source/OpenTK/Math/Matrix3d.cs
2013-01-26 16:29:23 -05:00
Robert Rouhani
8a7f506529 Added GL.UniformMatrix* double overloads. 2013-01-26 16:23:40 -05:00