Commit graph

5389 commits

Author SHA1 Message Date
Stefanos A.
12005e0792 Try to create Embedded context first
By mistake, this code would always create a desktop context. The correct
approach is to create an embedded (EGL) context and only fallback to
desktop if that doesn't work.
2013-11-11 11:43: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
4d717dcdda Allow '+' and '-' cmdline options for compatibility settings 2013-11-11 10:02:08 +01:00
thefiddler
8e9a9355b0 Allow overriding of Settings.Compatibility 2013-11-11 10:01:30 +01:00
thefiddler
0fcf3a2f40 Minor code cleanup 2013-11-11 10:01:15 +01:00
thefiddler
af16be42d5 Corrected Parameter.IsEnum property 2013-11-11 10:00:54 +01:00
thefiddler
dde7c645c4 Removed unused code 2013-11-11 10:00:32 +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.
d0e025b86d Restrict convenience overloads
Only Get*, Gen*, Delete* and New* functions get convenience overloads.
This avoids issues with functions such as Rect() that have similar
signatures but cannot use such overloads.

This restriction will be relaxed in the future.
2013-11-10 19:03:49 +01:00
Stefanos A.
293c020151 Added WrapperTypes.ConvenienceArrayType
These are convenience parameters for function receiving a size and an
array parameter, like DeleteTextures(int n, int[] ids). The generator
will now add overloads taking a single parameter, such as
DeleteTexture(int id).
2013-11-10 18:29:53 +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.
af7fdea449 Return types must be cls-compliant
CreateCLSCompliantWrappers must always change return types into
cls-compliant types. The reason is that we cannot overload on return
type alone, so we should always choose the compliant version.
2013-11-10 15:35:47 +01:00
Stefanos A.
6098fa05ce Plural name to singular in convenience overloads 2013-11-10 10:16:47 +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.
c1cb70d215 Improve indentation for doc comments
Doc comments are now split at their source, as a first step in
normalizing their indentation between VS and MD.
2013-11-10 09:12:42 +01:00
thefiddler
d126d25215 Add helper overload generation
Functions returning a value or array via an 'out' parameter will now get a convenience overload that returns the result via a return statement. In the case of arrays, only single-valued arrays will be supported. For example:

void GetIntegerv(enum pname, out int value)

will be get an overload of

int GetIntegerv(enum pname)

This will reduce the amount of helper overloads that must be maintained manually in GLHelpers.cs.
2013-11-10 08:28:58 +01:00
thefiddler
0d73706c88 Added new WrapperTypes; removed unused code
New WrapperTypes for convenience functions: ConvenienceReturnType to
replace an "out" parameter by a return value, and
ConvenienceArrayReturnType to replace an out array parameter by a
single return value (array count of 1 only).
2013-11-09 19:24:43 +01:00
thefiddler
417aa67139 Implemented Add and AddRange methods
These supplant the static Utilities.Merge() overloads.
2013-11-09 19:22:31 +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
0bf8565c0f Merge branch 'master' of https://github.com/thefiddler/opentk into modes 2013-11-09 17:17:22 +01:00
parallels
dff5e1c3a3 Maintain support for VS2010 and MD2.x 2013-11-09 17:16:00 +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.
b66912a8e1 Potential fix for issue 3430
EnableCap.ColorArray is part of the client state and must be enabled
with GL.EnableClientState, not GL.Enalbe. This is a potential fix for
http://www.opentk.com/node/3430 "Picking example's problem"
2013-11-09 15:13:50 +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