Merge pull request #524 from Nihlus/glwidget-gtk3
GTK3 updates for GLWidget
This commit is contained in:
commit
8c66c332ab
12 changed files with 582 additions and 520 deletions
|
@ -89,7 +89,6 @@ let activeProjects =
|
|||
|
||||
!! "src/**/*.??proj"
|
||||
++ "tests/**/OpenTK.Tests.fsproj"
|
||||
-- "**/OpenTK.GLWidget.csproj"
|
||||
|> xamarinFilter
|
||||
|
||||
// Generate assembly info files with the right version & up-to-date information
|
||||
|
|
|
@ -9,4 +9,4 @@ nuget xunit.runner.console
|
|||
nuget xunit.assert
|
||||
nuget FAKE
|
||||
nuget Mono.Cecil >= 0.10.0-beta1
|
||||
nuget GtkSharp
|
||||
nuget gtk-sharp3
|
||||
|
|
126
paket.lock
126
paket.lock
|
@ -1,6 +1,6 @@
|
|||
NUGET
|
||||
remote: https://www.nuget.org/api/v2
|
||||
FAKE (4.61.2)
|
||||
FAKE (4.61.3)
|
||||
FsCheck (2.9)
|
||||
FSharp.Core (>= 4.1) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
FSharp.Core (>= 4.1.17) - framework: >= netstandard16
|
||||
|
@ -13,39 +13,39 @@ NUGET
|
|||
xunit.core (>= 2.2) - framework: >= netstandard16
|
||||
xunit.extensibility.execution (>= 2.2 < 3.0) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
FSharp.Compiler.Service (2.0.0.6)
|
||||
FSharp.Core (4.1.17) - framework: >= net10, >= netstandard10
|
||||
System.Collections (>= 4.0.11) - framework: >= netstandard16
|
||||
System.Console (>= 4.0) - framework: >= netstandard16
|
||||
System.Diagnostics.Debug (>= 4.0.11) - framework: >= netstandard16
|
||||
System.Diagnostics.Tools (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Globalization (>= 4.0.11) - framework: >= netstandard16
|
||||
System.IO (>= 4.1) - framework: >= netstandard16
|
||||
System.Linq (>= 4.1) - framework: >= netstandard16
|
||||
System.Linq.Expressions (>= 4.1) - framework: >= netstandard16
|
||||
System.Linq.Queryable (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Net.Requests (>= 4.0.11) - framework: >= netstandard16
|
||||
System.Reflection (>= 4.1) - framework: >= netstandard16
|
||||
System.Reflection.Extensions (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Resources.ResourceManager (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Runtime (>= 4.1) - framework: >= netstandard16
|
||||
System.Runtime.Extensions (>= 4.1) - framework: >= netstandard16
|
||||
System.Runtime.Numerics (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Text.RegularExpressions (>= 4.1) - framework: >= netstandard16
|
||||
System.Threading (>= 4.0.11) - framework: >= netstandard16
|
||||
System.Threading.Tasks (>= 4.0.11) - framework: >= netstandard16
|
||||
System.Threading.Tasks.Parallel (>= 4.0.1) - framework: >= netstandard16
|
||||
System.Threading.Thread (>= 4.0) - framework: >= netstandard16
|
||||
System.Threading.ThreadPool (>= 4.0.10) - framework: >= netstandard16
|
||||
System.Threading.Timer (>= 4.0.1) - framework: >= netstandard16
|
||||
FSharp.Core (4.2.1) - framework: >= net10, >= netstandard10
|
||||
System.Collections (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.Console (>= 4.0) - framework: >= net463, >= netstandard16
|
||||
System.Diagnostics.Debug (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.Diagnostics.Tools (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Globalization (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.IO (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Linq (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Linq.Expressions (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Linq.Queryable (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Net.Requests (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.Reflection (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Reflection.Extensions (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Resources.ResourceManager (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Runtime (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Runtime.Extensions (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Runtime.Numerics (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Text.RegularExpressions (>= 4.1) - framework: >= net463, >= netstandard16
|
||||
System.Threading (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.Threading.Tasks (>= 4.0.11) - framework: >= net463, >= netstandard16
|
||||
System.Threading.Tasks.Parallel (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
System.Threading.Thread (>= 4.0) - framework: >= net463, >= netstandard16
|
||||
System.Threading.ThreadPool (>= 4.0.10) - framework: >= net463, >= netstandard16
|
||||
System.Threading.Timer (>= 4.0.1) - framework: >= net463, >= netstandard16
|
||||
FSharp.Formatting (2.14.4)
|
||||
FSharp.Compiler.Service (2.0.0.6)
|
||||
FSharpVSPowerTools.Core (>= 2.3 < 2.4)
|
||||
FSharpVSPowerTools.Core (2.3)
|
||||
FSharp.Compiler.Service (>= 2.0.0.3)
|
||||
GtkSharp (3.1.3)
|
||||
gtk-sharp3 (3.22)
|
||||
Microsoft.NETCore.Platforms (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Targets (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.Win32.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.Win32.Primitives (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -103,21 +103,21 @@ NUGET
|
|||
System.Threading.Timer (>= 4.3) - framework: >= net451, >= netstandard12
|
||||
System.Xml.ReaderWriter (>= 4.3) - framework: >= netstandard10
|
||||
System.Xml.XDocument (>= 4.3) - framework: >= netstandard10
|
||||
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.native.System (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.native.System (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1)
|
||||
Microsoft.NETCore.Targets (>= 1.1)
|
||||
runtime.native.System.IO.Compression (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.native.System.IO.Compression (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1)
|
||||
Microsoft.NETCore.Targets (>= 1.1)
|
||||
runtime.native.System.Net.Http (4.3) - framework: >= net10, >= netstandard16
|
||||
runtime.native.System.Net.Http (4.3) - framework: >= net45, >= netstandard16
|
||||
Microsoft.NETCore.Platforms (>= 1.1)
|
||||
Microsoft.NETCore.Targets (>= 1.1)
|
||||
runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16
|
||||
runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net45, >= netstandard16
|
||||
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3)
|
||||
runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
|
@ -128,17 +128,17 @@ NUGET
|
|||
runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
|
||||
runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16
|
||||
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net45, >= netstandard16
|
||||
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
System.AppContext (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16
|
||||
System.Buffers (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
System.Buffers (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard11
|
||||
System.Diagnostics.Tracing (>= 4.3) - framework: >= netstandard11
|
||||
System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard11
|
||||
|
@ -148,7 +148,7 @@ NUGET
|
|||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
System.Collections.Concurrent (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Collections.Concurrent (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
|
@ -159,7 +159,7 @@ NUGET
|
|||
System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13
|
||||
System.Console (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
System.Console (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13
|
||||
System.IO (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -169,7 +169,7 @@ NUGET
|
|||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
System.Diagnostics.DiagnosticSource (4.3.1) - framework: >= net10, netstandard13, >= netstandard16
|
||||
System.Diagnostics.DiagnosticSource (4.3.1) - framework: >= net45, netstandard13, >= netstandard16
|
||||
System.Collections (>= 4.3) - framework: netstandard11, >= netstandard13
|
||||
System.Diagnostics.Tracing (>= 4.3) - framework: netstandard11, >= netstandard13
|
||||
System.Reflection (>= 4.3) - framework: netstandard11, >= netstandard13
|
||||
|
@ -179,7 +179,7 @@ NUGET
|
|||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10
|
||||
System.Diagnostics.Tracing (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Diagnostics.Tracing (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15
|
||||
|
@ -192,7 +192,7 @@ NUGET
|
|||
Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13
|
||||
System.Globalization (>= 4.3) - framework: >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
System.Globalization.Extensions (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Globalization.Extensions (4.3) - framework: >= net45, >= netstandard16
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
System.Globalization (>= 4.3) - framework: >= netstandard13
|
||||
System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -205,7 +205,7 @@ NUGET
|
|||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15
|
||||
System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15
|
||||
System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15
|
||||
System.IO.Compression (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.IO.Compression (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
runtime.native.System (>= 4.3) - framework: >= netstandard13
|
||||
runtime.native.System.IO.Compression (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
|
@ -266,7 +266,7 @@ NUGET
|
|||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard16
|
||||
System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16
|
||||
System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard16
|
||||
System.Linq.Queryable (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Linq.Queryable (4.3) - framework: >= net463, >= netstandard16
|
||||
System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Linq (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
|
@ -275,7 +275,7 @@ NUGET
|
|||
System.Reflection.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13
|
||||
System.Net.Http (4.3.2) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Net.Http (4.3.2) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard13, >= netstandard16
|
||||
Microsoft.Win32.Primitives (>= 4.3) - framework: netstandard13
|
||||
runtime.native.System (>= 4.3) - framework: >= netstandard16
|
||||
|
@ -309,7 +309,7 @@ NUGET
|
|||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13
|
||||
System.Runtime.Handles (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Net.Requests (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Net.Requests (4.3) - framework: >= net463, >= netstandard16
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
|
@ -330,7 +330,7 @@ NUGET
|
|||
System.Net.Primitives (>= 4.3) - framework: >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
System.Threading.Tasks (>= 4.3) - framework: >= netstandard13
|
||||
System.Net.WebHeaderCollection (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Net.WebHeaderCollection (4.3) - framework: >= net463, >= netstandard16
|
||||
System.Collections (>= 4.3) - framework: >= netstandard13
|
||||
System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -406,12 +406,12 @@ NUGET
|
|||
System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard11
|
||||
System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard11
|
||||
System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard11
|
||||
System.Runtime.Numerics (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Runtime.Numerics (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13
|
||||
System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Security.Cryptography.Algorithms (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
System.Security.Cryptography.Algorithms (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard16
|
||||
runtime.native.System.Security.Cryptography.Apple (>= 4.3) - framework: >= netstandard16
|
||||
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16
|
||||
|
@ -452,7 +452,7 @@ NUGET
|
|||
System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net46, >= netstandard13
|
||||
System.Text.Encoding (>= 4.3) - framework: >= netstandard13
|
||||
System.Threading (>= 4.3) - framework: >= netstandard13
|
||||
System.Security.Cryptography.Encoding (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
System.Security.Cryptography.Encoding (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13
|
||||
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard13
|
||||
System.Collections (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -465,7 +465,7 @@ NUGET
|
|||
System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard13
|
||||
System.Security.Cryptography.Primitives (>= 4.3) - framework: >= netstandard13
|
||||
System.Text.Encoding (>= 4.3) - framework: >= netstandard13
|
||||
System.Security.Cryptography.OpenSsl (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Security.Cryptography.OpenSsl (4.3) - framework: >= net45, >= netstandard16
|
||||
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= net463, >= netstandard16, monoandroid, monotouch, xamarinios, xamarinmac
|
||||
System.Collections (>= 4.3) - framework: >= netstandard16
|
||||
System.IO (>= 4.3) - framework: >= net463, >= netstandard16
|
||||
|
@ -479,7 +479,7 @@ NUGET
|
|||
System.Security.Cryptography.Encoding (>= 4.3) - framework: >= net463, >= netstandard16
|
||||
System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net463, >= netstandard16
|
||||
System.Text.Encoding (>= 4.3) - framework: >= netstandard16
|
||||
System.Security.Cryptography.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15
|
||||
System.Security.Cryptography.Primitives (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard13
|
||||
System.Globalization (>= 4.3) - framework: >= netstandard13
|
||||
System.IO (>= 4.3) - framework: >= netstandard13
|
||||
|
@ -540,7 +540,7 @@ NUGET
|
|||
System.Collections (>= 4.3) - framework: >= netstandard10
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard10
|
||||
System.Threading.Tasks (>= 4.3) - framework: >= netstandard10
|
||||
System.Threading.Tasks.Parallel (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Threading.Tasks.Parallel (4.3) - framework: >= net463, >= netstandard16
|
||||
System.Collections.Concurrent (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13
|
||||
System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
|
@ -549,12 +549,12 @@ NUGET
|
|||
System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13
|
||||
System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13
|
||||
System.Threading.Thread (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Threading.Thread (4.3) - framework: >= net463, >= netstandard16
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
System.Threading.ThreadPool (4.3) - framework: >= net10, >= netstandard16
|
||||
System.Threading.ThreadPool (4.3) - framework: >= net463, >= netstandard16
|
||||
System.Runtime (>= 4.3) - framework: >= netstandard13
|
||||
System.Runtime.Handles (>= 4.3) - framework: >= netstandard13
|
||||
System.Threading.Timer (4.3) - framework: >= net10, >= netstandard12, netstandard13, netstandard14, netstandard15
|
||||
System.Threading.Timer (4.3) - framework: >= net451, >= netstandard12, netstandard13, netstandard14, netstandard15
|
||||
Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard12
|
||||
Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard12
|
||||
System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard12
|
||||
|
|
|
@ -1,95 +1,91 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.ComponentModel;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK;
|
||||
|
||||
using Gtk;
|
||||
using OpenTK.OSX;
|
||||
using OpenTK.Win;
|
||||
using OpenTK.X11;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="GLWidget"/> is a GTK widget for which an OpenGL context can be used to draw arbitrary graphics.
|
||||
/// </summary>
|
||||
[ToolboxItem(true)]
|
||||
public class GLWidget: DrawingArea, IDisposable
|
||||
public class GLWidget: DrawingArea
|
||||
{
|
||||
|
||||
#region Static attrs.
|
||||
|
||||
static int _GraphicsContextCount;
|
||||
static bool _SharedContextInitialized = false;
|
||||
private static int _GraphicsContextCount;
|
||||
private static bool _SharedContextInitialized = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Attributes
|
||||
|
||||
IGraphicsContext _GraphicsContext;
|
||||
IWindowInfo _WindowInfo;
|
||||
GraphicsContextFlags _GraphicsContextFlags;
|
||||
bool _Initialized = false;
|
||||
private IGraphicsContext _GraphicsContext;
|
||||
private IWindowInfo _WindowInfo;
|
||||
private GraphicsContextFlags _GraphicsContextFlags;
|
||||
private bool _Initialized = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>Use a single buffer versus a double buffer.</summary>
|
||||
/// <summary>
|
||||
/// Use a single buffer versus a double buffer.
|
||||
/// </summary>
|
||||
[Browsable(true)]
|
||||
public bool SingleBuffer { get; set; }
|
||||
|
||||
/// <summary>Color Buffer Bits-Per-Pixel</summary>
|
||||
/// <summary>
|
||||
/// Color Buffer Bits-Per-Pixel
|
||||
/// </summary>
|
||||
public int ColorBPP { get; set; }
|
||||
|
||||
/// <summary>Accumulation Buffer Bits-Per-Pixel</summary>
|
||||
/// <summary>
|
||||
/// Accumulation Buffer Bits-Per-Pixel
|
||||
/// </summary>
|
||||
public int AccumulatorBPP { get; set; }
|
||||
|
||||
/// <summary>Depth Buffer Bits-Per-Pixel</summary>
|
||||
/// <summary>
|
||||
/// Depth Buffer Bits-Per-Pixel
|
||||
/// </summary>
|
||||
public int DepthBPP { get; set; }
|
||||
|
||||
/// <summary>Stencil Buffer Bits-Per-Pixel</summary>
|
||||
/// <summary>
|
||||
/// Stencil Buffer Bits-Per-Pixel
|
||||
/// </summary>
|
||||
public int StencilBPP { get; set; }
|
||||
|
||||
/// <summary>Number of samples</summary>
|
||||
/// <summary>
|
||||
/// Number of samples
|
||||
/// </summary>
|
||||
public int Samples { get; set; }
|
||||
|
||||
/// <summary>Indicates if steropic renderering is enabled</summary>
|
||||
/// <summary>
|
||||
/// Indicates if steropic renderering is enabled
|
||||
/// </summary>
|
||||
public bool Stereo { get; set; }
|
||||
|
||||
/// <summary>The major version of OpenGL to use.</summary>
|
||||
/// <summary>
|
||||
/// The major version of OpenGL to use.
|
||||
/// </summary>
|
||||
public int GlVersionMajor { get; set; }
|
||||
|
||||
/// <summary>The minor version of OpenGL to use.</summary>
|
||||
/// <summary>
|
||||
/// The minor version of OpenGL to use.
|
||||
/// </summary>
|
||||
public int GlVersionMinor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The set <see cref="GraphicsContextFlags"/> for this widget.
|
||||
/// </summary>
|
||||
public GraphicsContextFlags GraphicsContextFlags
|
||||
{
|
||||
get
|
||||
|
@ -106,7 +102,9 @@ namespace OpenTK
|
|||
|
||||
#region Construction/Destruction
|
||||
|
||||
/// <summary>Constructs a new GLWidget.</summary>
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLWidget"/> class.
|
||||
/// </summary>
|
||||
public GLWidget()
|
||||
: this(GraphicsMode.Default)
|
||||
{
|
||||
|
@ -118,7 +116,15 @@ namespace OpenTK
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>Constructs a new GLWidget</summary>
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLWidget"/> class.
|
||||
/// </summary>
|
||||
/// <param name="graphicsMode">The <see cref="GraphicsMode"/> which the widget should be constructed with.</param>
|
||||
/// <param name="glVersionMajor">The major OpenGL version to attempt to initialize.</param>
|
||||
/// <param name="glVersionMinor">The minor OpenGL version to attempt to initialize.</param>
|
||||
/// <param name="graphicsContextFlags">
|
||||
/// Any flags which should be used during initialization of the <see cref="GraphicsContext"/>.
|
||||
/// </param>
|
||||
public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags graphicsContextFlags)
|
||||
{
|
||||
this.DoubleBuffered = false;
|
||||
|
@ -136,28 +142,55 @@ namespace OpenTK
|
|||
GraphicsContextFlags = graphicsContextFlags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructs this object.
|
||||
/// </summary>
|
||||
~GLWidget()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#if GTK3
|
||||
public override void Destroy() {
|
||||
#else
|
||||
public override void Dispose()
|
||||
/// <summary>
|
||||
/// Destroys this <see cref="Widget"/>, disposing it and destroying it in the context of GTK.
|
||||
/// </summary>
|
||||
public override void Destroy()
|
||||
{
|
||||
#endif
|
||||
GC.SuppressFinalize(this);
|
||||
Dispose(true);
|
||||
#if GTK3
|
||||
|
||||
base.Destroy();
|
||||
#else
|
||||
base.Dispose();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GTK3
|
||||
/// <summary>
|
||||
/// Disposes the current object, releasing any native resources it was using.
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
public override void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
Dispose(true);
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GTK3
|
||||
/// <summary>
|
||||
/// Disposes the current object, releasing any native resources it was using.
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
#else
|
||||
/// <summary>
|
||||
/// Disposes the current object, releasing any native resources it was using.
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
public virtual void Dispose(bool disposing)
|
||||
{
|
||||
#endif
|
||||
if (disposing)
|
||||
{
|
||||
_GraphicsContext.MakeCurrent(_WindowInfo);
|
||||
|
@ -175,45 +208,73 @@ namespace OpenTK
|
|||
|
||||
#region New Events
|
||||
|
||||
// Called when the first GraphicsContext is created in the case of GraphicsContext.ShareContexts == True;
|
||||
/// <summary>
|
||||
/// Called when the first <see cref="GraphicsContext"/> is created in the case where
|
||||
/// GraphicsContext.ShareContexts == true;
|
||||
/// </summary>
|
||||
public static event EventHandler GraphicsContextInitialized;
|
||||
|
||||
static void OnGraphicsContextInitialized()
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="GraphicsContextInitialized"/> event.
|
||||
/// </summary>
|
||||
private static void OnGraphicsContextInitialized()
|
||||
{
|
||||
if (GraphicsContextInitialized != null)
|
||||
GraphicsContextInitialized(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Called when the first GraphicsContext is being destroyed in the case of GraphicsContext.ShareContexts == True;
|
||||
/// <summary>
|
||||
/// Called when the first <see cref="GraphicsContext"/> is being destroyed in the case where
|
||||
/// GraphicsContext.ShareContext == true;
|
||||
/// </summary>
|
||||
public static event EventHandler GraphicsContextShuttingDown;
|
||||
|
||||
static void OnGraphicsContextShuttingDown()
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="GraphicsContextShuttingDown"/> event.
|
||||
/// </summary>
|
||||
private static void OnGraphicsContextShuttingDown()
|
||||
{
|
||||
if (GraphicsContextShuttingDown != null)
|
||||
GraphicsContextShuttingDown(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Called when this GLWidget has a valid GraphicsContext
|
||||
/// <summary>
|
||||
/// Called when this <see cref="GLWidget"/> has finished initializing and has a valid
|
||||
/// <see cref="GraphicsContext"/>.
|
||||
/// </summary>
|
||||
public event EventHandler Initialized;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Initialized"/> event.
|
||||
/// </summary>
|
||||
protected virtual void OnInitialized()
|
||||
{
|
||||
if (Initialized != null)
|
||||
Initialized(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Called when this GLWidget needs to render a frame
|
||||
/// <summary>
|
||||
/// Called when this <see cref="GLWidget"/> needs to render a frame.
|
||||
/// </summary>
|
||||
public event EventHandler RenderFrame;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="RenderFrame"/> event.
|
||||
/// </summary>
|
||||
protected virtual void OnRenderFrame()
|
||||
{
|
||||
if (RenderFrame != null)
|
||||
RenderFrame(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Called when this GLWidget is being Disposed
|
||||
/// <summary>
|
||||
/// Called when this <see cref="GLWidget"/> is being disposed.
|
||||
/// </summary>
|
||||
public event EventHandler ShuttingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="ShuttingDown"/> event.
|
||||
/// </summary>
|
||||
protected virtual void OnShuttingDown()
|
||||
{
|
||||
if (ShuttingDown != null)
|
||||
|
@ -222,13 +283,19 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
// Called when a widget is realized. (window handles and such are valid)
|
||||
// protected override void OnRealized() { base.OnRealized(); }
|
||||
|
||||
// Called when the widget needs to be (fully or partially) redrawn.
|
||||
#if GTK3
|
||||
/// <summary>
|
||||
/// Called when the widget needs to be (fully or partially) redrawn.
|
||||
/// </summary>
|
||||
/// <param name="cr"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool OnDrawn(Cairo.Context cr)
|
||||
#else
|
||||
/// <summary>
|
||||
/// Called when the widget is exposed.
|
||||
/// </summary>
|
||||
/// <param name="cr"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool OnExposeEvent(Gdk.EventExpose evnt)
|
||||
#endif
|
||||
{
|
||||
|
@ -254,7 +321,11 @@ namespace OpenTK
|
|||
return result;
|
||||
}
|
||||
|
||||
// Called on Resize
|
||||
/// <summary>
|
||||
/// Called whenever the widget is resized.
|
||||
/// </summary>
|
||||
/// <param name="evnt"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool OnConfigureEvent(Gdk.EventConfigure evnt)
|
||||
{
|
||||
bool result = base.OnConfigureEvent(evnt);
|
||||
|
@ -265,7 +336,10 @@ namespace OpenTK
|
|||
return result;
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="GLWidget"/> with its given values and creates a <see cref="GraphicsContext"/>.
|
||||
/// </summary>
|
||||
private void Initialize()
|
||||
{
|
||||
_Initialized = true;
|
||||
|
||||
|
@ -295,13 +369,19 @@ namespace OpenTK
|
|||
else
|
||||
Console.WriteLine("OpenTK running on X11");
|
||||
|
||||
#if GTK3
|
||||
IntPtr widgetWindowHandle = this.Window.Handle;
|
||||
#else
|
||||
IntPtr widgetWindowHandle = this.GdkWindow.Handle;
|
||||
#endif
|
||||
|
||||
// IWindowInfo
|
||||
if (Configuration.RunningOnWindows)
|
||||
_WindowInfo = InitializeWindows();
|
||||
_WindowInfo = WinWindowsInfoInitializer.Initialize(widgetWindowHandle);
|
||||
else if (Configuration.RunningOnMacOS)
|
||||
_WindowInfo = InitializeOSX();
|
||||
_WindowInfo = OSXWindowInfoInitializer.Initialize(widgetWindowHandle);
|
||||
else
|
||||
_WindowInfo = InitializeX(graphicsMode);
|
||||
_WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.Screen.RootWindow.Handle);
|
||||
|
||||
// GraphicsContext
|
||||
_GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags);
|
||||
|
@ -326,250 +406,5 @@ namespace OpenTK
|
|||
|
||||
OnInitialized();
|
||||
}
|
||||
|
||||
#region Windows Specific initalization
|
||||
|
||||
IWindowInfo InitializeWindows()
|
||||
{
|
||||
IntPtr windowHandle = gdk_win32_drawable_get_handle(GdkWindow.Handle);
|
||||
return Utilities.CreateWindowsWindowInfo(windowHandle);
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-win32-2.0-0.dll")]
|
||||
public static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);
|
||||
|
||||
#endregion
|
||||
|
||||
#region OSX Specific Initialization
|
||||
|
||||
IWindowInfo InitializeOSX()
|
||||
{
|
||||
IntPtr windowHandle = gdk_quartz_window_get_nswindow(this.GdkWindow.Handle);
|
||||
IntPtr viewHandle = gdk_quartz_window_get_nsview(this.GdkWindow.Handle);
|
||||
return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle);
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-quartz-2.0.0.dylib")]
|
||||
static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-quartz-2.0.0.dylib")]
|
||||
static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle);
|
||||
|
||||
#endregion
|
||||
|
||||
#region X Specific Initialization
|
||||
|
||||
#if GTK3
|
||||
const string UnixLibGdkName = "libgdk-3.so.0";
|
||||
#else
|
||||
const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
|
||||
#endif
|
||||
const string UnixLibX11Name = "libX11.so.6";
|
||||
const string UnixLibGLName = "libGL.so.1";
|
||||
|
||||
const int GLX_NONE = 0;
|
||||
const int GLX_USE_GL = 1;
|
||||
const int GLX_BUFFER_SIZE = 2;
|
||||
const int GLX_LEVEL = 3;
|
||||
const int GLX_RGBA = 4;
|
||||
const int GLX_DOUBLEBUFFER = 5;
|
||||
const int GLX_STEREO = 6;
|
||||
const int GLX_AUX_BUFFERS = 7;
|
||||
const int GLX_RED_SIZE = 8;
|
||||
const int GLX_GREEN_SIZE = 9;
|
||||
const int GLX_BLUE_SIZE = 10;
|
||||
const int GLX_ALPHA_SIZE = 11;
|
||||
const int GLX_DEPTH_SIZE = 12;
|
||||
const int GLX_STENCIL_SIZE = 13;
|
||||
const int GLX_ACCUM_RED_SIZE = 14;
|
||||
const int GLX_ACCUM_GREEN_SIZE = 15;
|
||||
const int GLX_ACCUM_BLUE_SIZE = 16;
|
||||
const int GLX_ACCUM_ALPHA_SIZE = 17;
|
||||
|
||||
public enum XVisualClass
|
||||
{
|
||||
StaticGray = 0,
|
||||
GrayScale = 1,
|
||||
StaticColor = 2,
|
||||
PseudoColor = 3,
|
||||
TrueColor = 4,
|
||||
DirectColor = 5,
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct XVisualInfo
|
||||
{
|
||||
public IntPtr Visual;
|
||||
public IntPtr VisualID;
|
||||
public int Screen;
|
||||
public int Depth;
|
||||
public XVisualClass Class;
|
||||
public long RedMask;
|
||||
public long GreenMask;
|
||||
public long blueMask;
|
||||
public int ColormapSize;
|
||||
public int BitsPerRgb;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||
VisualID, Screen, Depth, Class);
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
internal enum XVisualInfoMask
|
||||
{
|
||||
No = 0x0,
|
||||
ID = 0x1,
|
||||
Screen = 0x2,
|
||||
Depth = 0x4,
|
||||
Class = 0x8,
|
||||
Red = 0x10,
|
||||
Green = 0x20,
|
||||
Blue = 0x40,
|
||||
ColormapSize = 0x80,
|
||||
BitsPerRGB = 0x100,
|
||||
All = 0x1FF,
|
||||
}
|
||||
|
||||
IWindowInfo InitializeX(GraphicsMode mode)
|
||||
{
|
||||
IntPtr display = gdk_x11_display_get_xdisplay(Display.Handle);
|
||||
int screen = Screen.Number;
|
||||
#if GTK3
|
||||
IntPtr windowHandle = gdk_x11_window_get_xid(GdkWindow.Handle);
|
||||
IntPtr rootWindow = gdk_x11_window_get_xid(RootWindow.Handle);
|
||||
#else
|
||||
IntPtr windowHandle = gdk_x11_drawable_get_xid(GdkWindow.Handle);
|
||||
IntPtr rootWindow = gdk_x11_drawable_get_xid(RootWindow.Handle);
|
||||
#endif
|
||||
IWindowInfo retval;
|
||||
|
||||
IntPtr visualInfo;
|
||||
if (mode.Index.HasValue)
|
||||
{
|
||||
XVisualInfo info = new XVisualInfo();
|
||||
info.VisualID = mode.Index.Value;
|
||||
int dummy;
|
||||
visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy);
|
||||
}
|
||||
else
|
||||
visualInfo = GetVisualInfo(display);
|
||||
|
||||
retval = Utilities.CreateX11WindowInfo(display, screen, windowHandle, rootWindow, visualInfo);
|
||||
XFree(visualInfo);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask vinfo_mask, ref XVisualInfo template, out int nitems)
|
||||
{
|
||||
return XGetVisualInfoInternal(display, (IntPtr)(int)vinfo_mask, ref template, out nitems);
|
||||
}
|
||||
|
||||
IntPtr GetVisualInfo(IntPtr display)
|
||||
{
|
||||
try
|
||||
{
|
||||
int[] attributes = AttributeList.ToArray();
|
||||
return glXChooseVisual(display, Screen.Number, attributes);
|
||||
}
|
||||
catch (DllNotFoundException e)
|
||||
{
|
||||
throw new DllNotFoundException("OpenGL dll not found!", e);
|
||||
}
|
||||
catch (EntryPointNotFoundException enf)
|
||||
{
|
||||
throw new EntryPointNotFoundException("Glx entry point not found!", enf);
|
||||
}
|
||||
}
|
||||
|
||||
List<int> AttributeList
|
||||
{
|
||||
get
|
||||
{
|
||||
List<int> attributeList = new List<int>(24);
|
||||
|
||||
attributeList.Add(GLX_RGBA);
|
||||
|
||||
if (!SingleBuffer)
|
||||
attributeList.Add(GLX_DOUBLEBUFFER);
|
||||
|
||||
if (Stereo)
|
||||
attributeList.Add(GLX_STEREO);
|
||||
|
||||
attributeList.Add(GLX_RED_SIZE);
|
||||
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_GREEN_SIZE);
|
||||
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_BLUE_SIZE);
|
||||
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_ALPHA_SIZE);
|
||||
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_DEPTH_SIZE);
|
||||
attributeList.Add(DepthBPP);
|
||||
|
||||
attributeList.Add(GLX_STENCIL_SIZE);
|
||||
attributeList.Add(StencilBPP);
|
||||
|
||||
//attributeList.Add(GLX_AUX_BUFFERS);
|
||||
//attributeList.Add(Buffers);
|
||||
|
||||
attributeList.Add(GLX_ACCUM_RED_SIZE);
|
||||
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_ACCUM_GREEN_SIZE);
|
||||
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_ACCUM_BLUE_SIZE);
|
||||
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_ACCUM_ALPHA_SIZE);
|
||||
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add(GLX_NONE);
|
||||
|
||||
return attributeList;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")]
|
||||
static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)]
|
||||
static extern void XFree(IntPtr handle);
|
||||
|
||||
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
|
||||
/// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The ID of drawable's X resource. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay);
|
||||
|
||||
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
|
||||
/// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The ID of drawable's X resource. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay);
|
||||
|
||||
/// <summary> Returns the X display of a GdkDisplay. </summary>
|
||||
/// <remarks> Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The X Display of the GdkDisplay. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)]
|
||||
static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
38
src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs
Normal file
38
src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using OpenTK.Platform;
|
||||
|
||||
namespace OpenTK.OSX
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler class for initializing <see cref="IWindowInfo"/> objects under the OSX platform for both GTK2 and
|
||||
/// GTK3.
|
||||
/// </summary>
|
||||
public static class OSXWindowInfoInitializer
|
||||
{
|
||||
#if GTK3
|
||||
const string OSXLibGdkName = "libgdk-3.dylib";
|
||||
#else
|
||||
const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an <see cref="IWindowInfo"/> under the OSX platform.
|
||||
/// </summary>
|
||||
/// <param name="gdkWindowHandle"></param>
|
||||
public static IWindowInfo Initialize(IntPtr gdkWindowHandle)
|
||||
{
|
||||
IntPtr windowHandle = gdk_quartz_window_get_nswindow(gdkWindowHandle);
|
||||
IntPtr viewHandle = gdk_quartz_window_get_nsview(gdkWindowHandle);
|
||||
|
||||
return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle);
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)]
|
||||
private static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)]
|
||||
private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
|
@ -41,13 +41,14 @@
|
|||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<LangVersion>6</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;GTK3;</DefineConstants>
|
||||
<DocumentationFile>bin\Debug\OpenTK.GLWidget.xml</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
|
@ -65,7 +66,7 @@
|
|||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DefineConstants>TRACE;GTK3;</DefineConstants>
|
||||
<DocumentationFile>bin\Release\OpenTK.GLWidget.xml</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -87,13 +88,47 @@
|
|||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="$(DefineConstants.Contains('GTK3'))">
|
||||
<ItemGroup>
|
||||
<Reference Include="atk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\atk-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="cairo-sharp, Version=1.12.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\cairo-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gdk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gdk-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gio-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gio-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="glib-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\glib-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gtk-dotnet, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gtk-dotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="gtk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gtk-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="pango-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
|
||||
<HintPath>..\..\packages\gtk-sharp3\lib\net40\pango-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenTK\OpenTK.csproj">
|
||||
<Name>OpenTK</Name>
|
||||
|
@ -102,44 +137,17 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="OSX\OSXWindowInfoInitializer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GLWidget.cs" />
|
||||
<Compile Include="Win\WinWindowsInfoInitializer.cs" />
|
||||
<Compile Include="X11\XWindowInfoInitializer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="paket.references" />
|
||||
<None Include="paket.template" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<PropertyGroup>
|
||||
<__paket__GtkSharp_targets>net45\GtkSharp</__paket__GtkSharp_targets>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="cairo-sharp">
|
||||
<HintPath>..\..\packages\GtkSharp\lib\net45\cairo-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
<Reference Include="gio-sharp">
|
||||
<HintPath>..\..\packages\GtkSharp\lib\net45\gio-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="..\..\packages\GtkSharp\build\$(__paket__GtkSharp_targets).targets" Condition="Exists('..\..\packages\GtkSharp\build\$(__paket__GtkSharp_targets).targets')" Label="Paket" />
|
||||
</Project>
|
43
src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs
Normal file
43
src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using OpenTK.Platform;
|
||||
|
||||
namespace OpenTK.Win
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler class for initializing <see cref="IWindowInfo"/> objects under the Windows platform for both GTK2 and
|
||||
/// GTK3.
|
||||
/// </summary>
|
||||
public static class WinWindowsInfoInitializer
|
||||
{
|
||||
#if GTK3
|
||||
private const string WinLibGDKName = "libgdk-3-0.dll";
|
||||
#else
|
||||
private const string WinLibGDKName = "libgdk-win32-2.0-0.dll";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an <see cref="IWindowInfo"/> under the Windows platform.
|
||||
/// </summary>
|
||||
/// <param name="gdkWindowHandle"></param>
|
||||
public static IWindowInfo Initialize(IntPtr gdkWindowHandle)
|
||||
{
|
||||
#if GTK3
|
||||
IntPtr windowHandle = gdk_win32_window_get_handle(gdkWindowHandle);
|
||||
#else
|
||||
IntPtr windowHandle = gdk_win32_drawable_get_handle(gdkWindowHandle);
|
||||
#endif
|
||||
return Utilities.CreateWindowsWindowInfo(windowHandle);
|
||||
}
|
||||
|
||||
#if GTK3
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gdk_win32_window_get_handle(IntPtr w);
|
||||
#else
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
175
src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs
Normal file
175
src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs
Normal file
|
@ -0,0 +1,175 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK.Platform.X11;
|
||||
|
||||
namespace OpenTK.X11
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler class for initializing <see cref="IWindowInfo"/> objects under the X11 platform for both GTK2 and GTK3.
|
||||
/// </summary>
|
||||
public static class XWindowInfoInitializer
|
||||
{
|
||||
|
||||
#if GTK3
|
||||
const string UnixLibGdkName = "libgdk-3.so.0";
|
||||
#else
|
||||
const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
|
||||
#endif
|
||||
private const string UnixLibX11Name = "libX11.so.6";
|
||||
private const string UnixLibGLName = "libGL.so.1";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an <see cref="IWindowInfo"/> under the X11 platform.
|
||||
/// </summary>
|
||||
/// <param name="mode"></param>
|
||||
/// <param name="displayHandle"></param>
|
||||
/// <param name="screenNumber"></param>
|
||||
/// <param name="gdkWindowHandle"></param>
|
||||
/// <param name="gdkRootWindowHandle"></param>
|
||||
/// <returns></returns>
|
||||
public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle)
|
||||
{
|
||||
IntPtr display = gdk_x11_display_get_xdisplay(displayHandle);
|
||||
|
||||
#if GTK3
|
||||
IntPtr windowXid = gdk_x11_window_get_xid(gdkWindowHandle);
|
||||
IntPtr rootWindowXid = gdk_x11_window_get_xid(gdkRootWindowHandle);
|
||||
#else
|
||||
IntPtr windowXid = gdk_x11_drawable_get_xid(gdkWindowHandle);
|
||||
IntPtr rootWindowXid = gdk_x11_drawable_get_xid(gdkRootWindowHandle);
|
||||
#endif
|
||||
|
||||
IntPtr visualInfo;
|
||||
if (mode.Index.HasValue)
|
||||
{
|
||||
XVisualInfo info = new XVisualInfo
|
||||
{
|
||||
VisualID = mode.Index.Value
|
||||
};
|
||||
|
||||
int dummy;
|
||||
visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
visualInfo = GetVisualInfo(mode, display, screenNumber);
|
||||
}
|
||||
|
||||
IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, visualInfo);
|
||||
XFree(visualInfo);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask infoMask, ref XVisualInfo template, out int nitems)
|
||||
{
|
||||
return XGetVisualInfoInternal(display, (IntPtr)(int)infoMask, ref template, out nitems);
|
||||
}
|
||||
|
||||
private static IntPtr GetVisualInfo(GraphicsMode mode, IntPtr display, int screenNumber)
|
||||
{
|
||||
try
|
||||
{
|
||||
int[] attributes = CreateAttributeList(mode).ToArray();
|
||||
return glXChooseVisual(display, screenNumber, attributes);
|
||||
}
|
||||
catch (DllNotFoundException e)
|
||||
{
|
||||
throw new DllNotFoundException("OpenGL dll not found!", e);
|
||||
}
|
||||
catch (EntryPointNotFoundException enf)
|
||||
{
|
||||
throw new EntryPointNotFoundException("Glx entry point not found!", enf);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<int> CreateAttributeList(GraphicsMode mode)
|
||||
{
|
||||
List<int> attributeList = new List<int>(24);
|
||||
|
||||
attributeList.Add((int)GLXAttribute.RGBA);
|
||||
|
||||
if (mode.Buffers > 1)
|
||||
{
|
||||
attributeList.Add((int)GLXAttribute.DOUBLEBUFFER);
|
||||
}
|
||||
|
||||
if (mode.Stereo)
|
||||
{
|
||||
attributeList.Add((int)GLXAttribute.STEREO);
|
||||
}
|
||||
|
||||
attributeList.Add((int)GLXAttribute.RED_SIZE);
|
||||
attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.GREEN_SIZE);
|
||||
attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.BLUE_SIZE);
|
||||
attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.ALPHA_SIZE);
|
||||
attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.DEPTH_SIZE);
|
||||
attributeList.Add(mode.Depth);
|
||||
|
||||
attributeList.Add((int)GLXAttribute.STENCIL_SIZE);
|
||||
attributeList.Add(mode.Stencil);
|
||||
|
||||
//attributeList.Add(GLX_AUX_BUFFERS);
|
||||
//attributeList.Add(Buffers);
|
||||
|
||||
attributeList.Add((int)GLXAttribute.ACCUM_RED_SIZE);
|
||||
attributeList.Add(mode.AccumulatorFormat.Red / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.ACCUM_GREEN_SIZE);
|
||||
attributeList.Add(mode.AccumulatorFormat.Green / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.ACCUM_BLUE_SIZE);
|
||||
attributeList.Add(mode.AccumulatorFormat.Blue / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.ACCUM_ALPHA_SIZE);
|
||||
attributeList.Add(mode.AccumulatorFormat.Alpha / 4);// TODO support 16-bit
|
||||
|
||||
attributeList.Add((int)GLXAttribute.NONE);
|
||||
|
||||
return attributeList;
|
||||
}
|
||||
|
||||
[DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")]
|
||||
private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr infoMask, ref XVisualInfo template, out int nitems);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)]
|
||||
private static extern void XFree(IntPtr handle);
|
||||
|
||||
#if GTK3
|
||||
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkWindow. </summary>
|
||||
/// <remarks> XID gdk_x11_window_get_xid(GdkWindow *drawable); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The ID of window's X resource. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay);
|
||||
#else
|
||||
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
|
||||
/// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The ID of drawable's X resource. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay);
|
||||
#endif
|
||||
/// <summary> Returns the X display of a GdkDisplay. </summary>
|
||||
/// <remarks> Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); </remarks>
|
||||
/// <param name="gdkDisplay"> The GdkDrawable. </param>
|
||||
/// <returns> The X Display of the GdkDisplay. </returns>
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
|
||||
private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)]
|
||||
private static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr);
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
GtkSharp
|
||||
gtk-sharp3
|
||||
|
|
|
@ -607,10 +607,10 @@ XF86VidModeGetGammaRampSize(
|
|||
|
||||
#endregion
|
||||
|
||||
#region internal class XVisualInfo
|
||||
#region public class XVisualInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct XVisualInfo
|
||||
public struct XVisualInfo
|
||||
{
|
||||
public IntPtr Visual;
|
||||
public VisualID VisualID;
|
||||
|
@ -1367,7 +1367,7 @@ XF86VidModeGetGammaRampSize(
|
|||
#pragma warning restore 1591
|
||||
|
||||
[Flags]
|
||||
internal enum XVisualInfoMask
|
||||
public enum XVisualInfoMask
|
||||
{
|
||||
No = 0x0,
|
||||
ID = 0x1,
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenTK.Platform.X11
|
|||
{
|
||||
#region Enums
|
||||
|
||||
enum GLXAttribute : int
|
||||
public enum GLXAttribute : int
|
||||
{
|
||||
TRANSPARENT_BLUE_VALUE_EXT = 0x27,
|
||||
GRAY_SCALE = 0x8006,
|
||||
|
|
|
@ -147,24 +147,6 @@
|
|||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
<HintPath>..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
<HintPath>..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
|
@ -183,24 +165,6 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5')">
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.0'">
|
||||
<ItemGroup>
|
||||
<Reference Include="FSharp.Core">
|
||||
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Paket>True</Paket>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
|
@ -1437,7 +1401,7 @@
|
|||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Threading.Thread">
|
||||
<HintPath>..\..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll</HintPath>
|
||||
|
@ -1457,7 +1421,7 @@
|
|||
</When>
|
||||
</Choose>
|
||||
<Choose>
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Threading.ThreadPool">
|
||||
<HintPath>..\..\packages\System.Threading.ThreadPool\lib\net46\System.Threading.ThreadPool.dll</HintPath>
|
||||
|
|
Loading…
Reference in a new issue