Trim regex will now correctly match GetInteger64 and other functions
ending in "64". It also uses a correct ending anchor to avoid matches
in the middle of a function name.
Scan through the list of wrappers once, instead of multiple times, in
order to find out which functions use which enums. This speeds up enum
generation tremendously.
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.
The lookup for function overrides and overloads now tries to work
around extension case mismatches (e.g. IBM vs Ibm). This fixes a few
specific cases of missing overrides.
It is now possible to specify multiple overloads for the same function.
This is helpful for maintaining backwards compatibility with previous
releases.
SDL does not currently support embedding into Windows Forms (this is an
upstream limitation.) To ensure that existing WinForms applications
continue to function even if SDL is installed, GLControl will now try to
initialize OpenTK with a native backend. The user can still override
this behavior using OpenTK.Toolkit.Init(ToolkitOptions), as normal.
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.
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.)
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.
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.
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.
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).
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.
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.
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).
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()).
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.
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"
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.
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.
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.
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!
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.
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.
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.
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
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.
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.
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.
Paths that don't define a "version" attribute will now match all
possible versions. This will make it easier to add support for newer
APIs as they are introduced.
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.
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.
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).
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.
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.
Sometimes an enum may reuse the tokens of another enum verbatim
(possibly adding a few extra tokens.) The reuse directive simplifies
the handling of this case:
<enum name="Foo">
<reuse enum="Bar" />
</enum>
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.
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.
Signatures were split into 4 APIs before (gl, glcore, gles1, gles2).
However, gles2 contains bindings for both version 2.0 and 3.0. The
version information is now maintained, which allows us to cut down on
the number of generated enumerations.
Now that we support function overloads, it is safe to ignore functions
that are defined multiple times. We just merge their Category
properties if they are not identical.
It is now possible to define multiple overloads of the same function,
each with different parameters. This is extremely useful for
maintaining backwards compatibility in the face of the changes between
GL 4.3 and 4.4.
Tokens are now sorted according to their value, exactly is in the
upstream gl.xml spec. Additionally, gles1 and gles2 now include the
pre-defined groups in the specification.
Sometimes elements in overrides.xml contain extra spaces due to typos,
which are quite difficult to track down. The XmlSpecReader can now
cope with that.
OpenTK does not currently support generating bindings for pointers of
order 3 or higher. No OpenGL or OpenGL ES API currently uses such
pointers, so we just issue a warning message if such an API is
encountered in the future.