Initial support for Android/iOS
This commit is contained in:
parent
9976a4a422
commit
bcddc07c9f
56 changed files with 5556 additions and 180 deletions
73
OpenTK.Android.sln
Normal file
73
OpenTK.Android.sln
Normal file
|
@ -0,0 +1,73 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 12.0.31101.0
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Android", "Source\OpenTK\OpenTK.Android.csproj", "{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB} = {C426C9D1-8857-4E52-BAC7-4C05EE6070AB}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Rewrite", "Source\Generator.Rewrite\Generator.Rewrite.csproj", "{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{02D273EB-BABD-4D9D-9EB4-73E9AF1934A5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES11", "Source\Samples\Android\ES11\ES11.csproj", "{61E47728-8B64-442E-89EA-1FE6D2ADE654}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Documentation|Any CPU = Documentation|Any CPU
|
||||
Nsis|Any CPU = Nsis|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Nsis|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Nsis|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Documentation|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Nsis|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Nsis|Any CPU.Build.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Nsis|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{61E47728-8B64-442E-89EA-1FE6D2ADE654} = {02D273EB-BABD-4D9D-9EB4-73E9AF1934A5}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Samples\ES11\ES11.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
189
OpenTK.iOS.sln
Normal file
189
OpenTK.iOS.sln
Normal file
|
@ -0,0 +1,189 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 12.0.31101.0
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.iOS", "Source\OpenTK\OpenTK.iOS.csproj", "{88368190-E3DF-4EBE-ACAA-7B1779F376CA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB} = {C426C9D1-8857-4E52-BAC7-4C05EE6070AB}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{35FBBDFF-CD76-4452-A22E-7EE5A4B64A7D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES11", "Source\Samples\iOS\ES11\ES11.csproj", "{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB} = {C426C9D1-8857-4E52-BAC7-4C05EE6070AB}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Rewrite", "Source\Generator.Rewrite\Generator.Rewrite.csproj", "{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
|
||||
AppStore|Any CPU = AppStore|Any CPU
|
||||
AppStore|iPhone = AppStore|iPhone
|
||||
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Documentation|Any CPU = Documentation|Any CPU
|
||||
Documentation|iPhone = Documentation|iPhone
|
||||
Documentation|iPhoneSimulator = Documentation|iPhoneSimulator
|
||||
Nsis|Any CPU = Nsis|Any CPU
|
||||
Nsis|iPhone = Nsis|iPhone
|
||||
Nsis|iPhoneSimulator = Nsis|iPhoneSimulator
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Documentation|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Documentation|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Nsis|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Nsis|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Nsis|iPhone.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Nsis|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{88368190-E3DF-4EBE-ACAA-7B1779F376CA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Ad-Hoc|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|Any CPU.ActiveCfg = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.AppStore|iPhoneSimulator.Deploy.0 = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhone.ActiveCfg = Debug|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhone.Build.0 = Debug|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhone.Deploy.0 = Debug|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Documentation|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhone.ActiveCfg = Release|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhone.Build.0 = Release|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhone.Deploy.0 = Release|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Nsis|iPhoneSimulator.Deploy.0 = AppStore|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.AppStore|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Ad-Hoc|iPhone.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Ad-Hoc|iPhone.Build.0 = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.AppStore|iPhone.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.AppStore|iPhone.Build.0 = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|iPhone.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|iPhoneSimulator.ActiveCfg = Documentation|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|iPhone.ActiveCfg = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|iPhoneSimulator.ActiveCfg = Nsis|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59} = {35FBBDFF-CD76-4452-A22E-7EE5A4B64A7D}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Samples\ES11\ES11.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -37,6 +37,7 @@ namespace OpenTK.Rewrite
|
|||
Console.WriteLine("Usage: rewrite [file.dll] [file.snk] [options]");
|
||||
Console.WriteLine("[options] is:");
|
||||
Console.WriteLine(" -debug (enable calls to GL.GetError())");
|
||||
Console.WriteLine(" -dllimport (force calls to use DllImport instead of GetProcAddress)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,8 +59,12 @@ namespace OpenTK.Rewrite
|
|||
// OpenTK.BindingsBase
|
||||
static TypeDefinition TypeBindingsBase;
|
||||
|
||||
static bool dllimport;
|
||||
|
||||
void Rewrite(string file, string keyfile, IEnumerable<string> options)
|
||||
{
|
||||
dllimport = options.Contains("-dllimport");
|
||||
|
||||
// Specify assembly read and write parameters
|
||||
// We want to keep a valid symbols file (pdb or mdb)
|
||||
var read_params = new ReaderParameters();
|
||||
|
@ -101,10 +106,17 @@ namespace OpenTK.Rewrite
|
|||
{
|
||||
foreach (var reference in module.AssemblyReferences)
|
||||
{
|
||||
var resolved = module.AssemblyResolver.Resolve(reference);
|
||||
if (reference.Name == "mscorlib")
|
||||
try
|
||||
{
|
||||
mscorlib = resolved;
|
||||
var resolved = module.AssemblyResolver.Resolve(reference);
|
||||
if (reference.Name == "mscorlib")
|
||||
{
|
||||
mscorlib = resolved;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Error.WriteLine(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,6 +178,10 @@ namespace OpenTK.Rewrite
|
|||
|
||||
int GetSlot(MethodDefinition signature)
|
||||
{
|
||||
// Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS)
|
||||
if (dllimport)
|
||||
return -1;
|
||||
|
||||
var slot_attribute = signature.CustomAttributes
|
||||
.FirstOrDefault(a => a.AttributeType.Name == "SlotAttribute");
|
||||
int slot =
|
||||
|
|
|
@ -134,7 +134,27 @@ namespace OpenTK
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region public static bool RunningOnIOS
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <c>System.Boolean</c> indicating whether
|
||||
/// OpenTK is running on an Android device.
|
||||
/// </summary>
|
||||
public static bool RunningOnIOS
|
||||
{
|
||||
get
|
||||
{
|
||||
#if IPHONE
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Private Methods ---
|
||||
|
||||
|
@ -196,6 +216,7 @@ namespace OpenTK
|
|||
return t != null;
|
||||
}
|
||||
|
||||
#if SDL2
|
||||
static bool DetectSdl2()
|
||||
{
|
||||
bool supported = false;
|
||||
|
@ -252,6 +273,7 @@ namespace OpenTK
|
|||
|
||||
return supported;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void DetectUnix(out bool unix, out bool linux, out bool macos)
|
||||
{
|
||||
|
@ -290,9 +312,13 @@ namespace OpenTK
|
|||
|
||||
static bool DetectX11()
|
||||
{
|
||||
#if X11
|
||||
// Detect whether X is present.
|
||||
try { return OpenTK.Platform.X11.API.DefaultDisplay != IntPtr.Zero; }
|
||||
catch { return false; }
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -310,12 +336,8 @@ namespace OpenTK
|
|||
{
|
||||
if (!initialized)
|
||||
{
|
||||
#if ANDROID
|
||||
#if ANDROID || IPHONE
|
||||
runningOnMono = true;
|
||||
runningOnAnroid = true;
|
||||
#elif IPHONE
|
||||
runningOnMono = true;
|
||||
runningOnIOS = true;
|
||||
#else
|
||||
runningOnMono = DetectMono();
|
||||
runningOnWindows = DetectWindows();
|
||||
|
|
|
@ -12,7 +12,11 @@ namespace OpenTK.Graphics.ES11
|
|||
|
||||
public sealed partial class GL : GraphicsBindingsBase
|
||||
{
|
||||
#if IPHONE
|
||||
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
|
||||
#else
|
||||
const string Library = "GLESv1_CM";
|
||||
#endif
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
|
|
|
@ -40,7 +40,11 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
public sealed partial class GL : GraphicsBindingsBase
|
||||
{
|
||||
#if IPHONE
|
||||
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
|
||||
#else
|
||||
const string Library = "libGLESv2.dll";
|
||||
#endif
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
|
|
|
@ -40,7 +40,11 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
public sealed partial class GL : GraphicsBindingsBase
|
||||
{
|
||||
#if IPHONE
|
||||
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
|
||||
#else
|
||||
const string Library = "libGLESv2.dll";
|
||||
#endif
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
|
|
|
@ -386,6 +386,14 @@ namespace OpenTK.Graphics
|
|||
|
||||
internal static GetCurrentContextDelegate GetCurrentContext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handle of the current GraphicsContext in the calling thread.
|
||||
/// </summary>
|
||||
public static ContextHandle CurrentContextHandle
|
||||
{
|
||||
get { return GetCurrentContext(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GraphicsContext that is current in the calling thread.
|
||||
/// </summary>
|
||||
|
@ -401,7 +409,7 @@ namespace OpenTK.Graphics
|
|||
{
|
||||
if (available_contexts.Count > 0)
|
||||
{
|
||||
ContextHandle handle = GetCurrentContext();
|
||||
ContextHandle handle = CurrentContextHandle;
|
||||
if (handle.Handle != IntPtr.Zero)
|
||||
return (IGraphicsContext)available_contexts[handle];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Drawing;
|
|||
#endif
|
||||
using System.Text;
|
||||
|
||||
#if IPHONE || ANDROID || MINIMAL
|
||||
#if ANDROID || IPHONE || MINIMAL
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ namespace OpenTK
|
|||
public static void Flush() { }
|
||||
}
|
||||
|
||||
#if MINIMAL
|
||||
|
||||
// System.Diagnostics.Stopwatch
|
||||
sealed class Stopwatch
|
||||
{
|
||||
|
@ -83,6 +85,8 @@ namespace OpenTK
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// System.Xml.XmlIgnoreAttribute
|
||||
class XmlIgnoreAttribute : Attribute
|
||||
{
|
||||
|
|
|
@ -1,51 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{F278D4AB-4730-4720-B08E-FE5E31564D9E};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>OpenTK.Android</RootNamespace>
|
||||
<RootNamespace>OpenTK</RootNamespace>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>OpenTK.Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.2</TargetFrameworkVersion>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>OpenTK-1.1</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ANDROID</DefineConstants>
|
||||
<OutputPath>..\..\Binaries\Android\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ANDROID;OPENGLES;OPENTK_1_1</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>..\..\Binaries\Android\Debug\OpenTK-1.1.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Android\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>ANDROID</DefineConstants>
|
||||
<DefineConstants>ANDROID;OPENGLES;OPENTK_1_1</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DocumentationFile>..\..\Binaries\Android\Release\OpenTK-1.1.xml</DocumentationFile>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Compile Include="AutoGeneratedAttribute.cs" />
|
||||
<Compile Include="BindingsBase.cs" />
|
||||
|
@ -62,11 +64,21 @@
|
|||
<Compile Include="IGameWindow.cs" />
|
||||
<Compile Include="INativeWindow.cs" />
|
||||
<Compile Include="IntPtrEqualityComparer.cs" />
|
||||
<Compile Include="InteropHelper.cs" />
|
||||
<Compile Include="KeyPressEventArgs.cs" />
|
||||
<Compile Include="Minimal.cs" />
|
||||
<Compile Include="MouseCursor.cs" />
|
||||
<Compile Include="NativeWindow.cs" />
|
||||
<Compile Include="Platform\Android\AndroidDisplayDeviceDriver.cs" />
|
||||
<Compile Include="Platform\Android\AndroidGraphicsMode.cs" />
|
||||
<Compile Include="Platform\Android\GLCalls.cs" />
|
||||
<Compile Include="Platform\Egl\EglException.cs" />
|
||||
<Compile Include="RewrittenAttribute.cs" />
|
||||
<Compile Include="SlotAttribute.cs" />
|
||||
<Compile Include="Toolkit.cs" />
|
||||
<Compile Include="ToolkitOptions.cs" />
|
||||
<Compile Include="WindowBorder.cs" />
|
||||
<Compile Include="WindowIcon.cs" />
|
||||
<Compile Include="WindowState.cs" />
|
||||
<Compile Include="Audio\AudioCapture.cs" />
|
||||
<Compile Include="Audio\AudioContext.cs" />
|
||||
|
@ -84,27 +96,6 @@
|
|||
<Compile Include="Audio\OpenAL\AL\XRamExtension.cs" />
|
||||
<Compile Include="Audio\OpenAL\Alc\Alc.cs" />
|
||||
<Compile Include="Audio\OpenAL\Alc\AlcEnums.cs" />
|
||||
<Compile Include="Compute\CLHelper.cs" />
|
||||
<Compile Include="Compute\CommandQueue.cs" />
|
||||
<Compile Include="Compute\ComputeContext.cs" />
|
||||
<Compile Include="Compute\Configuration.cs" />
|
||||
<Compile Include="Compute\Device.cs" />
|
||||
<Compile Include="Compute\Enums.cs" />
|
||||
<Compile Include="Compute\Event.cs" />
|
||||
<Compile Include="Compute\Kernel.cs" />
|
||||
<Compile Include="Compute\Memory.cs" />
|
||||
<Compile Include="Compute\Platform.cs" />
|
||||
<Compile Include="Compute\Profiler.cs" />
|
||||
<Compile Include="Compute\Program.cs" />
|
||||
<Compile Include="Compute\Sampler.cs" />
|
||||
<Compile Include="Compute\Structs.cs" />
|
||||
<Compile Include="Compute\CL10\CL.cs" />
|
||||
<Compile Include="Compute\CL10\CLHelper.cs" />
|
||||
<Compile Include="Compute\CL10\Core.cs" />
|
||||
<Compile Include="Compute\CL10\Delegates.cs" />
|
||||
<Compile Include="Compute\CL10\Enums.cs" />
|
||||
<Compile Include="Compute\CL10\ErrorHelper.cs" />
|
||||
<Compile Include="Compute\CL10\ImageFormat.cs" />
|
||||
<Compile Include="Graphics\Color4.cs" />
|
||||
<Compile Include="Graphics\ColorFormat.cs" />
|
||||
<Compile Include="Graphics\GraphicsBindingsBase.cs" />
|
||||
|
@ -121,46 +112,56 @@
|
|||
<Compile Include="Graphics\GraphicsModeException.cs" />
|
||||
<Compile Include="Graphics\IGraphicsContext.cs" />
|
||||
<Compile Include="Graphics\IGraphicsMode.cs" />
|
||||
<Compile Include="Graphics\ES10\Core.cs" />
|
||||
<Compile Include="Graphics\ES10\Delegates.cs" />
|
||||
<Compile Include="Graphics\ES10\ES.cs" />
|
||||
<Compile Include="Graphics\ES10\Enums.cs" />
|
||||
<Compile Include="Graphics\ES10\ErrorHelper.cs" />
|
||||
<Compile Include="Graphics\ES10\Helper.cs" />
|
||||
<Compile Include="Graphics\ES11\Core.cs" />
|
||||
<Compile Include="Graphics\ES11\Delegates.cs" />
|
||||
<Compile Include="Graphics\ES11\ES.cs" />
|
||||
<Compile Include="Graphics\ES11\Enums.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11Enums.cs" />
|
||||
<Compile Include="Graphics\ES11\ErrorHelper.cs" />
|
||||
<Compile Include="Graphics\ES11\Helper.cs" />
|
||||
<Compile Include="Graphics\ES20\Core.cs" />
|
||||
<Compile Include="Graphics\ES20\Delegates.cs" />
|
||||
<Compile Include="Graphics\ES20\ES.cs" />
|
||||
<Compile Include="Graphics\ES20\Enums.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20Enums.cs" />
|
||||
<Compile Include="Graphics\ES20\ErrorHelper.cs" />
|
||||
<Compile Include="Graphics\ES20\Helper.cs" />
|
||||
<Compile Include="Graphics\OpenGL\ErrorHelper.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GL.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GLCore.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GLDelegates.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GLEnums.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GLHelper.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30Enums.cs" />
|
||||
<Compile Include="Graphics\ES30\ErrorHelper.cs" />
|
||||
<Compile Include="Graphics\ES30\Helper.cs" />
|
||||
<Compile Include="Input\ButtonState.cs" />
|
||||
<Compile Include="Input\Buttons.cs" />
|
||||
<Compile Include="Input\ConfigurationType.cs" />
|
||||
<Compile Include="Input\GamePad.cs" />
|
||||
<Compile Include="Input\GamePadAxis.cs" />
|
||||
<Compile Include="Input\GamePadButton.cs" />
|
||||
<Compile Include="Input\GamePadAxes.cs" />
|
||||
<Compile Include="Input\GamePadButtons.cs" />
|
||||
<Compile Include="Input\GamePadCapabilities.cs" />
|
||||
<Compile Include="Input\GamePadConfiguration.cs" />
|
||||
<Compile Include="Input\GamePadConfigurationDatabase.cs" />
|
||||
<Compile Include="Input\GamePadConfigurationItem.cs" />
|
||||
<Compile Include="Input\GamePadConfigurationSource.cs" />
|
||||
<Compile Include="Input\GamePadConfigurationTarget.cs" />
|
||||
<Compile Include="Input\GamePadDPad.cs" />
|
||||
<Compile Include="Input\GamePadState.cs" />
|
||||
<Compile Include="Input\GamePadThumbSticks.cs" />
|
||||
<Compile Include="Input\GamePadTriggers.cs" />
|
||||
<Compile Include="Input\GamePadType.cs" />
|
||||
<Compile Include="Input\HatPosition.cs" />
|
||||
<Compile Include="Input\IGamePadDriver.cs" />
|
||||
<Compile Include="Input\IInputDevice.cs" />
|
||||
<Compile Include="Input\IInputDriver.cs" />
|
||||
<Compile Include="Input\IInputDriver2.cs" />
|
||||
<Compile Include="Input\IJoystickDriver.cs" />
|
||||
<Compile Include="Input\IJoystickDriver2.cs" />
|
||||
<Compile Include="Input\IKeyboardDriver.cs" />
|
||||
<Compile Include="Input\IKeyboardDriver2.cs" />
|
||||
<Compile Include="Input\IMouseDriver.cs" />
|
||||
<Compile Include="Input\IMouseDriver2.cs" />
|
||||
<Compile Include="Input\Joystick.cs" />
|
||||
<Compile Include="Input\JoystickAxis.cs" />
|
||||
<Compile Include="Input\JoystickButton.cs" />
|
||||
<Compile Include="Input\JoystickCapabilities.cs" />
|
||||
<Compile Include="Input\JoystickDevice.cs" />
|
||||
<Compile Include="Input\JoystickHat.cs" />
|
||||
<Compile Include="Input\JoystickHatState.cs" />
|
||||
<Compile Include="Input\JoystickState.cs" />
|
||||
<Compile Include="Input\Key.cs" />
|
||||
<Compile Include="Input\KeyModifiers.cs" />
|
||||
<Compile Include="Input\Keyboard.cs" />
|
||||
<Compile Include="Input\KeyboardDevice.cs" />
|
||||
<Compile Include="Input\KeyboardKeyEventArgs.cs" />
|
||||
|
@ -168,6 +169,8 @@
|
|||
<Compile Include="Input\Mouse.cs" />
|
||||
<Compile Include="Input\MouseButton.cs" />
|
||||
<Compile Include="Input\MouseDevice.cs" />
|
||||
<Compile Include="Input\MouseEventArgs.cs" />
|
||||
<Compile Include="Input\MouseScroll.cs" />
|
||||
<Compile Include="Input\MouseState.cs" />
|
||||
<Compile Include="Math\BezierCurve.cs" />
|
||||
<Compile Include="Math\BezierCurveCubic.cs" />
|
||||
|
@ -216,98 +219,44 @@
|
|||
<Compile Include="Platform\INativeGLWindow.cs" />
|
||||
<Compile Include="Platform\IPlatformFactory.cs" />
|
||||
<Compile Include="Platform\IWindowInfo.cs" />
|
||||
<Compile Include="Platform\LegacyInputDriver.cs" />
|
||||
<Compile Include="Platform\LegacyJoystickDriver.cs" />
|
||||
<Compile Include="Platform\MappedGamePadDriver.cs" />
|
||||
<Compile Include="Platform\NativeWindowBase.cs" />
|
||||
<Compile Include="Platform\PlatformException.cs" />
|
||||
<Compile Include="Platform\PlatformFactoryBase.cs" />
|
||||
<Compile Include="Platform\Utilities.cs" />
|
||||
<Compile Include="Platform\Dummy\DummyGLContext.cs" />
|
||||
<Compile Include="Platform\Dummy\DummyWindowInfo.cs" />
|
||||
<Compile Include="Platform\Egl\Egl.cs" />
|
||||
<Compile Include="Platform\Egl\EglContext.cs" />
|
||||
<Compile Include="Platform\Egl\EglGraphicsMode.cs" />
|
||||
<Compile Include="Platform\Egl\EglMacPlatformFactory.cs" />
|
||||
<Compile Include="Platform\Egl\EglSdl2PlatformFactory.cs" />
|
||||
<Compile Include="Platform\Egl\EglWinPlatformFactory.cs" />
|
||||
<Compile Include="Platform\Egl\EglWindowInfo.cs" />
|
||||
<Compile Include="Platform\Egl\EglX11PlatformFactory.cs" />
|
||||
<Compile Include="Platform\MacOS\AglContext.cs" />
|
||||
<Compile Include="Platform\MacOS\Application.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonGLNative.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonInput.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonWindowInfo.cs" />
|
||||
<Compile Include="Platform\MacOS\Cgl.cs" />
|
||||
<Compile Include="Platform\MacOS\EventInfo.cs" />
|
||||
<Compile Include="Platform\MacOS\HIDInput.cs" />
|
||||
<Compile Include="Platform\MacOS\MacOSException.cs" />
|
||||
<Compile Include="Platform\MacOS\MacOSFactory.cs" />
|
||||
<Compile Include="Platform\MacOS\MacOSGraphicsMode.cs" />
|
||||
<Compile Include="Platform\MacOS\MacOSKeyMap.cs" />
|
||||
<Compile Include="Platform\MacOS\QuartzDisplayDeviceDriver.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\Agl.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\CarbonAPI.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\CoreFoundation.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\MacOSKeys.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\QuartzDisplayServicesAPI.cs" />
|
||||
<Compile Include="Platform\MacOS\CarbonBindings\SpeechChannel.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2DisplayDeviceDriver.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2Factory.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2GraphicsContext.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2GraphicsMode.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2InputDriver.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2JoystickDriver.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2KeyMap.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2Keyboard.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2Mouse.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2NativeWindow.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2WindowInfo.cs" />
|
||||
<Compile Include="Platform\SDL2\sdl2-cs\src\LPUtf8StrMarshaler.cs" />
|
||||
<Compile Include="Platform\SDL2\sdl2-cs\src\SDL2.cs" />
|
||||
<Compile Include="Platform\Windows\API.cs" />
|
||||
<Compile Include="Platform\Windows\WglHelper.cs" />
|
||||
<Compile Include="Platform\Windows\WinDisplayDevice.cs" />
|
||||
<Compile Include="Platform\Windows\WinFactory.cs" />
|
||||
<Compile Include="Platform\Windows\WinGLContext.cs" />
|
||||
<Compile Include="Platform\Windows\WinGLNative.cs" />
|
||||
<Compile Include="Platform\Windows\WinGraphicsMode.cs" />
|
||||
<Compile Include="Platform\Windows\WinInputBase.cs" />
|
||||
<Compile Include="Platform\Windows\WinKeyMap.cs" />
|
||||
<Compile Include="Platform\Windows\WinMMJoystick.cs" />
|
||||
<Compile Include="Platform\Windows\WinRawInput.cs" />
|
||||
<Compile Include="Platform\Windows\WinRawKeyboard.cs" />
|
||||
<Compile Include="Platform\Windows\WinRawMouse.cs" />
|
||||
<Compile Include="Platform\Windows\WinWindowInfo.cs" />
|
||||
<Compile Include="Platform\Windows\Bindings\Wgl.cs" />
|
||||
<Compile Include="Platform\Windows\Bindings\WglCore.cs" />
|
||||
<Compile Include="Platform\Windows\Bindings\WglDelegates.cs" />
|
||||
<Compile Include="Platform\Windows\Bindings\WglEnums.cs" />
|
||||
<Compile Include="Platform\X11\API.cs" />
|
||||
<Compile Include="Platform\X11\Functions.cs" />
|
||||
<Compile Include="Platform\X11\GlxHelper.cs" />
|
||||
<Compile Include="Platform\X11\Structs.cs" />
|
||||
<Compile Include="Platform\X11\X11DisplayDevice.cs" />
|
||||
<Compile Include="Platform\X11\X11Factory.cs" />
|
||||
<Compile Include="Platform\X11\X11GLContext.cs" />
|
||||
<Compile Include="Platform\X11\X11GLNative.cs" />
|
||||
<Compile Include="Platform\X11\X11GraphicsMode.cs" />
|
||||
<Compile Include="Platform\X11\X11Input.cs" />
|
||||
<Compile Include="Platform\X11\X11Joystick.cs" />
|
||||
<Compile Include="Platform\X11\X11KeyMap.cs" />
|
||||
<Compile Include="Platform\X11\X11Keyboard.cs" />
|
||||
<Compile Include="Platform\X11\X11Mouse.cs" />
|
||||
<Compile Include="Platform\X11\X11WindowInfo.cs" />
|
||||
<Compile Include="Platform\X11\XI2Mouse.cs" />
|
||||
<Compile Include="Platform\X11\Bindings\Glx.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs" />
|
||||
<Compile Include="Platform\Android\AndroidFactory.cs" />
|
||||
<Compile Include="Platform\Android\Enums.cs" />
|
||||
<Compile Include="Platform\Android\AndroidGameView.cs" />
|
||||
<Compile Include="Platform\Android\AndroidGraphicsContext.cs" />
|
||||
<Compile Include="Platform\Android\GameViewBase.cs" />
|
||||
<Compile Include="Platform\X11\Bindings\DL.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OpenTK.Android.csproj" />
|
||||
<None Include="OpenTK.csproj" />
|
||||
<None Include="OpenTK.dll.config" />
|
||||
<None Include="OpenTK.xml" />
|
||||
<None Include="Platform\.DS_Store" />
|
||||
<None Include="Platform\SDL2\sdl2-cs\.gitignore" />
|
||||
<None Include="Platform\SDL2\sdl2-cs\LICENSE" />
|
||||
<None Include="Platform\SDL2\sdl2-cs\README" />
|
||||
<None Include="Properties\Resources.resx" />
|
||||
<None Include="OpenTK.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="AfterBuild">
|
||||
<Exec Command="$(OutputPath)..\..\Tools\Debug\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport -debug" Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="$(OutputPath)..\..\Tools\Release\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport" Condition="$(OS) == 'Windows_NT' and $(Configuration) != 'Debug'" />
|
||||
<Exec Command="mono $(OutputPath)..\..\Tools\Debug\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport -debug" Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="mono $(OutputPath)..\..\Tools\Release\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport" Condition="$(OS) != 'Windows_NT' and $(Configuration) != 'Debug'" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -46,7 +46,7 @@
|
|||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES</DefineConstants>
|
||||
<DocumentationFile>..\..\Binaries\OpenTK\Debug\OpenTK.xml</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
|
@ -80,7 +80,7 @@
|
|||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DefineConstants>TRACE;WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES</DefineConstants>
|
||||
<DocumentationFile>..\..\Binaries\OpenTK\Release\OpenTK.xml</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<DebugType>pdbonly</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DefineConstants>TRACE;WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES</DefineConstants>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -126,7 +126,7 @@
|
|||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DefineConstants>TRACE;WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES</DefineConstants>
|
||||
<DocumentationFile>..\..\Binaries\OpenTK\Release\OpenTK.xml</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -199,6 +199,7 @@
|
|||
<Compile Include="Math\Matrix4x3d.cs" />
|
||||
<Compile Include="Platform\Common\Hid.cs" />
|
||||
<Compile Include="Platform\DisplayDeviceBase.cs" />
|
||||
<Compile Include="Platform\Egl\EglException.cs" />
|
||||
<Compile Include="Platform\Egl\EglUnixContext.cs" />
|
||||
<Compile Include="Platform\Egl\EglWinContext.cs" />
|
||||
<Compile Include="Platform\MappedGamePadDriver.cs" />
|
||||
|
|
250
Source/OpenTK/OpenTK.iOS.csproj
Normal file
250
Source/OpenTK/OpenTK.iOS.csproj
Normal file
|
@ -0,0 +1,250 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{88368190-E3DF-4EBE-ACAA-7B1779F376CA}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>OpenTK</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>OpenTK-1.1</AssemblyName>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Binaries\iOS\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;IPHONE;OPENGLES;OPENTK_1;OPENTK_1_1</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>..\..\Binaries\iOS\Debug\OpenTK.1.1.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Binaries\iOS\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>IPHONE;OPENGLES;OPENTK_1;OPENTK_1_1</DefineConstants>
|
||||
<DocumentationFile>..\..\Binaries\iOS\Release\OpenTK.1.1.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AutoGeneratedAttribute.cs"/>
|
||||
<Compile Include="BindingsBase.cs"/>
|
||||
<Compile Include="BlittableValueType.cs"/>
|
||||
<Compile Include="Configuration.cs"/>
|
||||
<Compile Include="ContextHandle.cs"/>
|
||||
<Compile Include="DisplayDevice.cs"/>
|
||||
<Compile Include="DisplayIndex.cs"/>
|
||||
<Compile Include="DisplayResolution.cs"/>
|
||||
<Compile Include="Exceptions.cs"/>
|
||||
<Compile Include="FrameEventArgs.cs"/>
|
||||
<Compile Include="GameWindow.cs"/>
|
||||
<Compile Include="GameWindowFlags.cs"/>
|
||||
<Compile Include="IGameWindow.cs"/>
|
||||
<Compile Include="INativeWindow.cs"/>
|
||||
<Compile Include="IntPtrEqualityComparer.cs"/>
|
||||
<Compile Include="InteropHelper.cs"/>
|
||||
<Compile Include="KeyPressEventArgs.cs"/>
|
||||
<Compile Include="Minimal.cs"/>
|
||||
<Compile Include="MouseCursor.cs"/>
|
||||
<Compile Include="NativeWindow.cs"/>
|
||||
<Compile Include="Platform\iPhoneOS\iPhoneDisplayDeviceDriver.cs"/>
|
||||
<Compile Include="RewrittenAttribute.cs"/>
|
||||
<Compile Include="SlotAttribute.cs"/>
|
||||
<Compile Include="Toolkit.cs"/>
|
||||
<Compile Include="ToolkitOptions.cs"/>
|
||||
<Compile Include="WindowBorder.cs"/>
|
||||
<Compile Include="WindowIcon.cs"/>
|
||||
<Compile Include="WindowState.cs"/>
|
||||
<Compile Include="Audio\AudioCapture.cs"/>
|
||||
<Compile Include="Audio\AudioContext.cs"/>
|
||||
<Compile Include="Audio\AudioContextException.cs"/>
|
||||
<Compile Include="Audio\AudioDeviceEnumerator.cs"/>
|
||||
<Compile Include="Audio\AudioDeviceErrorChecker.cs"/>
|
||||
<Compile Include="Audio\AudioDeviceException.cs"/>
|
||||
<Compile Include="Audio\AudioException.cs"/>
|
||||
<Compile Include="Audio\AudioValueException.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\AL.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\ALEnums.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\EffectsExtension.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\EffectsExtensionEnums.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\EffectsExtensionPresets.cs"/>
|
||||
<Compile Include="Audio\OpenAL\AL\XRamExtension.cs"/>
|
||||
<Compile Include="Audio\OpenAL\Alc\Alc.cs"/>
|
||||
<Compile Include="Audio\OpenAL\Alc\AlcEnums.cs"/>
|
||||
<Compile Include="Graphics\Color4.cs"/>
|
||||
<Compile Include="Graphics\ColorFormat.cs"/>
|
||||
<Compile Include="Graphics\GraphicsBindingsBase.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContext.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContextBase.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContextException.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContextFlags.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContextMissingException.cs"/>
|
||||
<Compile Include="Graphics\GraphicsContextVersion.cs"/>
|
||||
<Compile Include="Graphics\GraphicsErrorException.cs"/>
|
||||
<Compile Include="Graphics\GraphicsExceptions.cs"/>
|
||||
<Compile Include="Graphics\GraphicsMode.cs"/>
|
||||
<Compile Include="Graphics\GraphicsModeComparer.cs"/>
|
||||
<Compile Include="Graphics\GraphicsModeException.cs"/>
|
||||
<Compile Include="Graphics\IGraphicsContext.cs"/>
|
||||
<Compile Include="Graphics\IGraphicsMode.cs"/>
|
||||
<Compile Include="Graphics\ES11\ES11.cs"/>
|
||||
<Compile Include="Graphics\ES11\ES11Enums.cs"/>
|
||||
<Compile Include="Graphics\ES11\ES11Obsolete.cs"/>
|
||||
<Compile Include="Graphics\ES11\ErrorHelper.cs"/>
|
||||
<Compile Include="Graphics\ES11\Helper.cs"/>
|
||||
<Compile Include="Graphics\ES20\ES20.cs"/>
|
||||
<Compile Include="Graphics\ES20\ES20Enums.cs"/>
|
||||
<Compile Include="Graphics\ES20\ErrorHelper.cs"/>
|
||||
<Compile Include="Graphics\ES20\Helper.cs"/>
|
||||
<Compile Include="Graphics\ES30\ES30.cs"/>
|
||||
<Compile Include="Graphics\ES30\ES30Enums.cs"/>
|
||||
<Compile Include="Graphics\ES30\ErrorHelper.cs"/>
|
||||
<Compile Include="Graphics\ES30\Helper.cs"/>
|
||||
<Compile Include="Input\ButtonState.cs"/>
|
||||
<Compile Include="Input\Buttons.cs"/>
|
||||
<Compile Include="Input\ConfigurationType.cs"/>
|
||||
<Compile Include="Input\GamePad.cs"/>
|
||||
<Compile Include="Input\GamePadAxes.cs"/>
|
||||
<Compile Include="Input\GamePadButtons.cs"/>
|
||||
<Compile Include="Input\GamePadCapabilities.cs"/>
|
||||
<Compile Include="Input\GamePadConfiguration.cs"/>
|
||||
<Compile Include="Input\GamePadConfigurationDatabase.cs"/>
|
||||
<Compile Include="Input\GamePadConfigurationItem.cs"/>
|
||||
<Compile Include="Input\GamePadConfigurationSource.cs"/>
|
||||
<Compile Include="Input\GamePadConfigurationTarget.cs"/>
|
||||
<Compile Include="Input\GamePadDPad.cs"/>
|
||||
<Compile Include="Input\GamePadState.cs"/>
|
||||
<Compile Include="Input\GamePadThumbSticks.cs"/>
|
||||
<Compile Include="Input\GamePadTriggers.cs"/>
|
||||
<Compile Include="Input\GamePadType.cs"/>
|
||||
<Compile Include="Input\HatPosition.cs"/>
|
||||
<Compile Include="Input\IGamePadDriver.cs"/>
|
||||
<Compile Include="Input\IInputDevice.cs"/>
|
||||
<Compile Include="Input\IInputDriver.cs"/>
|
||||
<Compile Include="Input\IInputDriver2.cs"/>
|
||||
<Compile Include="Input\IJoystickDriver.cs"/>
|
||||
<Compile Include="Input\IJoystickDriver2.cs"/>
|
||||
<Compile Include="Input\IKeyboardDriver.cs"/>
|
||||
<Compile Include="Input\IKeyboardDriver2.cs"/>
|
||||
<Compile Include="Input\IMouseDriver.cs"/>
|
||||
<Compile Include="Input\IMouseDriver2.cs"/>
|
||||
<Compile Include="Input\Joystick.cs"/>
|
||||
<Compile Include="Input\JoystickAxis.cs"/>
|
||||
<Compile Include="Input\JoystickButton.cs"/>
|
||||
<Compile Include="Input\JoystickCapabilities.cs"/>
|
||||
<Compile Include="Input\JoystickDevice.cs"/>
|
||||
<Compile Include="Input\JoystickHat.cs"/>
|
||||
<Compile Include="Input\JoystickHatState.cs"/>
|
||||
<Compile Include="Input\JoystickState.cs"/>
|
||||
<Compile Include="Input\Key.cs"/>
|
||||
<Compile Include="Input\KeyModifiers.cs"/>
|
||||
<Compile Include="Input\Keyboard.cs"/>
|
||||
<Compile Include="Input\KeyboardDevice.cs"/>
|
||||
<Compile Include="Input\KeyboardKeyEventArgs.cs"/>
|
||||
<Compile Include="Input\KeyboardState.cs"/>
|
||||
<Compile Include="Input\Mouse.cs"/>
|
||||
<Compile Include="Input\MouseButton.cs"/>
|
||||
<Compile Include="Input\MouseDevice.cs"/>
|
||||
<Compile Include="Input\MouseEventArgs.cs"/>
|
||||
<Compile Include="Input\MouseScroll.cs"/>
|
||||
<Compile Include="Input\MouseState.cs"/>
|
||||
<Compile Include="Math\BezierCurve.cs"/>
|
||||
<Compile Include="Math\BezierCurveCubic.cs"/>
|
||||
<Compile Include="Math\BezierCurveQuadric.cs"/>
|
||||
<Compile Include="Math\Box2.cs"/>
|
||||
<Compile Include="Math\Functions.cs"/>
|
||||
<Compile Include="Math\Half.cs"/>
|
||||
<Compile Include="Math\MathHelper.cs"/>
|
||||
<Compile Include="Math\Matrix2.cs"/>
|
||||
<Compile Include="Math\Matrix2d.cs"/>
|
||||
<Compile Include="Math\Matrix2x3.cs"/>
|
||||
<Compile Include="Math\Matrix2x3d.cs"/>
|
||||
<Compile Include="Math\Matrix2x4.cs"/>
|
||||
<Compile Include="Math\Matrix2x4d.cs"/>
|
||||
<Compile Include="Math\Matrix3.cs"/>
|
||||
<Compile Include="Math\Matrix3d.cs"/>
|
||||
<Compile Include="Math\Matrix3x2.cs"/>
|
||||
<Compile Include="Math\Matrix3x2d.cs"/>
|
||||
<Compile Include="Math\Matrix3x4.cs"/>
|
||||
<Compile Include="Math\Matrix3x4d.cs"/>
|
||||
<Compile Include="Math\Matrix4.cs"/>
|
||||
<Compile Include="Math\Matrix4d.cs"/>
|
||||
<Compile Include="Math\Matrix4x2.cs"/>
|
||||
<Compile Include="Math\Matrix4x2d.cs"/>
|
||||
<Compile Include="Math\Matrix4x3.cs"/>
|
||||
<Compile Include="Math\Matrix4x3d.cs"/>
|
||||
<Compile Include="Math\Point.cs"/>
|
||||
<Compile Include="Math\Quaternion.cs"/>
|
||||
<Compile Include="Math\Quaterniond.cs"/>
|
||||
<Compile Include="Math\Rectangle.cs"/>
|
||||
<Compile Include="Math\Size.cs"/>
|
||||
<Compile Include="Math\Vector2.cs"/>
|
||||
<Compile Include="Math\Vector2d.cs"/>
|
||||
<Compile Include="Math\Vector2h.cs"/>
|
||||
<Compile Include="Math\Vector3.cs"/>
|
||||
<Compile Include="Math\Vector3d.cs"/>
|
||||
<Compile Include="Math\Vector3h.cs"/>
|
||||
<Compile Include="Math\Vector4.cs"/>
|
||||
<Compile Include="Math\Vector4d.cs"/>
|
||||
<Compile Include="Math\Vector4h.cs"/>
|
||||
<Compile Include="Platform\DesktopGraphicsContext.cs"/>
|
||||
<Compile Include="Platform\DisplayDeviceBase.cs"/>
|
||||
<Compile Include="Platform\EmbeddedGraphicsContext.cs"/>
|
||||
<Compile Include="Platform\Factory.cs"/>
|
||||
<Compile Include="Platform\IDisplayDeviceDriver.cs"/>
|
||||
<Compile Include="Platform\INativeGLWindow.cs"/>
|
||||
<Compile Include="Platform\IPlatformFactory.cs"/>
|
||||
<Compile Include="Platform\IWindowInfo.cs"/>
|
||||
<Compile Include="Platform\LegacyInputDriver.cs"/>
|
||||
<Compile Include="Platform\LegacyJoystickDriver.cs"/>
|
||||
<Compile Include="Platform\MappedGamePadDriver.cs"/>
|
||||
<Compile Include="Platform\NativeWindowBase.cs"/>
|
||||
<Compile Include="Platform\PlatformException.cs"/>
|
||||
<Compile Include="Platform\PlatformFactoryBase.cs"/>
|
||||
<Compile Include="Platform\Utilities.cs"/>
|
||||
<Compile Include="Platform\Dummy\DummyGLContext.cs"/>
|
||||
<Compile Include="Platform\Dummy\DummyWindowInfo.cs"/>
|
||||
<Compile Include="Platform\iPhoneOS\iPhoneFactory.cs"/>
|
||||
<Compile Include="Platform\iPhoneOS\iPhoneOSGameView.cs"/>
|
||||
<Compile Include="Platform\iPhoneOS\iPhoneOSGraphicsContext.cs"/>
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
<Compile Include="Platform\MacOS\NS.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OpenTK.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="AfterBuild">
|
||||
<Exec Command="$(OutputPath)..\..\Tools\Debug\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport -debug" Condition="$(OS) == 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="$(OutputPath)..\..\Tools\Release\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport" Condition="$(OS) == 'Windows_NT' and $(Configuration) != 'Debug'" />
|
||||
<Exec Command="mono $(OutputPath)..\..\Tools\Debug\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport -debug" Condition="$(OS) != 'Windows_NT' and $(Configuration) == 'Debug'" />
|
||||
<Exec Command="mono $(OutputPath)..\..\Tools\Release\Rewrite.exe $(OutputPath)$(AssemblyName).dll ..\..\OpenTK.snk -dllimport" Condition="$(OS) != 'Windows_NT' and $(Configuration) != 'Debug'" />
|
||||
</Target>
|
||||
</Project>
|
40
Source/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs
Normal file
40
Source/OpenTK/Platform/Android/AndroidDisplayDeviceDriver.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Platform.Android
|
||||
{
|
||||
class AndroidDisplayDeviceDriver : IDisplayDeviceDriver
|
||||
{
|
||||
static DisplayDevice dev;
|
||||
static AndroidDisplayDeviceDriver ()
|
||||
{
|
||||
dev = new DisplayDevice ();
|
||||
dev.IsPrimary = true;
|
||||
dev.BitsPerPixel = 16;
|
||||
}
|
||||
|
||||
public DisplayDevice GetDisplay(DisplayIndex displayIndex)
|
||||
{
|
||||
return (displayIndex == DisplayIndex.First || displayIndex == DisplayIndex.Primary) ? dev : null;
|
||||
}
|
||||
|
||||
|
||||
public bool TryChangeResolution (DisplayDevice device, DisplayResolution resolution)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryRestoreResolution (DisplayDevice device)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
66
Source/OpenTK/Platform/Android/AndroidFactory.cs
Normal file
66
Source/OpenTK/Platform/Android/AndroidFactory.cs
Normal file
|
@ -0,0 +1,66 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform.Android
|
||||
{
|
||||
sealed class AndroidFactory : PlatformFactoryBase
|
||||
{
|
||||
#region IPlatformFactory Members
|
||||
|
||||
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
AndroidWindow android_win = (AndroidWindow)window;
|
||||
return new Android.AndroidGraphicsContext(mode, android_win.CreateEglWindowInfo(), shareContext, major, minor, flags);
|
||||
}
|
||||
|
||||
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
AndroidWindow android_win = (AndroidWindow)window;
|
||||
return new Android.AndroidGraphicsContext(handle, android_win.CreateEglWindowInfo(), shareContext, major, minor, flags);
|
||||
}
|
||||
|
||||
public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
||||
{
|
||||
return (GraphicsContext.GetCurrentContextDelegate)delegate
|
||||
{
|
||||
return new ContextHandle(Egl.Egl.GetCurrentContext());
|
||||
};
|
||||
}
|
||||
|
||||
public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
||||
{
|
||||
return new AndroidDisplayDeviceDriver();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IKeyboardDriver2 CreateKeyboardDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IMouseDriver2 CreateMouseDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IJoystickDriver2 CreateJoystickDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
676
Source/OpenTK/Platform/Android/AndroidGameView.cs
Normal file
676
Source/OpenTK/Platform/Android/AndroidGameView.cs
Normal file
|
@ -0,0 +1,676 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Timers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK.Platform.Android;
|
||||
|
||||
using Android.Content;
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using Android.Runtime;
|
||||
using Android.Graphics;
|
||||
using OpenTK.Platform.Egl;
|
||||
|
||||
namespace OpenTK.Platform.Android
|
||||
{
|
||||
[Register ("opentk_1_1/platform/android/AndroidGameView")]
|
||||
public partial class AndroidGameView : GameViewBase, ISurfaceHolderCallback
|
||||
{
|
||||
bool disposed;
|
||||
System.Timers.Timer timer;
|
||||
Java.Util.Timer j_timer;
|
||||
ISurfaceHolder mHolder;
|
||||
GLCalls gl;
|
||||
AndroidWindow windowInfo;
|
||||
Object ticking = new Object ();
|
||||
bool stopped = true;
|
||||
bool renderOn = false;
|
||||
bool sizeChanged = false;
|
||||
bool requestRender = false;
|
||||
bool autoSetContextOnRenderFrame = true;
|
||||
bool renderOnUIThread = true;
|
||||
bool callMakeCurrent = false;
|
||||
CancellationTokenSource source;
|
||||
Task renderTask;
|
||||
Thread renderingThread;
|
||||
ManualResetEvent pauseSignal;
|
||||
global::Android.Graphics.Rect surfaceRect;
|
||||
Size size;
|
||||
System.Diagnostics.Stopwatch stopWatch;
|
||||
double tick = 0;
|
||||
|
||||
[Register (".ctor", "(Landroid/content/Context;)V", "")]
|
||||
public AndroidGameView (Context context) : base (context)
|
||||
{
|
||||
Init ();
|
||||
}
|
||||
|
||||
[Register (".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")]
|
||||
public AndroidGameView (Context context, IAttributeSet attrs) : base (context, attrs)
|
||||
{
|
||||
Init ();
|
||||
}
|
||||
|
||||
public AndroidGameView (IntPtr handle, global::Android.Runtime.JniHandleOwnership transfer)
|
||||
: base (handle, transfer)
|
||||
{
|
||||
Init ();
|
||||
}
|
||||
|
||||
private void Init ()
|
||||
{
|
||||
// default
|
||||
ContextRenderingApi = GLVersion.ES1;
|
||||
mHolder = Holder;
|
||||
RenderThreadRestartRetries = 3;
|
||||
|
||||
// Add callback to get the SurfaceCreated etc events
|
||||
mHolder.AddCallback (this);
|
||||
// Force the SurfaceType to be Gpu to API_11 and earlier
|
||||
// it is ignored in later API's
|
||||
mHolder.SetType (SurfaceType.Gpu);
|
||||
windowInfo = new AndroidWindow (mHolder);
|
||||
|
||||
pauseSignal = new ManualResetEvent (true);
|
||||
}
|
||||
|
||||
public void SurfaceCreated (ISurfaceHolder holder)
|
||||
{
|
||||
log ("SurfaceCreated");
|
||||
|
||||
callMakeCurrent = true;
|
||||
CreateSurface ();
|
||||
|
||||
// Surface size or format has changed
|
||||
surfaceRect = holder.SurfaceFrame;
|
||||
size = new Size (surfaceRect.Right - surfaceRect.Left, surfaceRect.Bottom - surfaceRect.Top);
|
||||
|
||||
LoadInternal (EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void SurfaceDestroyed (ISurfaceHolder holder)
|
||||
{
|
||||
log ("SurfaceDestroyed");
|
||||
|
||||
// TODO: Somehow DestroySurface is being called twice (once by SurfaceDestroyed and once by UnloadInternal->DestroyFrameBuffer)
|
||||
DestroySurface();
|
||||
|
||||
UnloadInternal (EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void SurfaceChanged (ISurfaceHolder holder, Format format, int w, int h)
|
||||
{
|
||||
log ("SurfaceChanged");
|
||||
|
||||
callMakeCurrent = true;
|
||||
|
||||
Width = w;
|
||||
Height = h;
|
||||
|
||||
// Surface size or format has changed
|
||||
surfaceRect = holder.SurfaceFrame;
|
||||
size = new Size (surfaceRect.Right - surfaceRect.Left, surfaceRect.Bottom - surfaceRect.Top);
|
||||
|
||||
if (OpenTK.Graphics.GraphicsContext.CurrentContextHandle.Handle != IntPtr.Zero && RenderOnUIThread) {
|
||||
GLCalls.Viewport (0, 0, size.Width, size.Height);
|
||||
GLCalls.Scissor (0, 0, size.Width, size.Height);
|
||||
}
|
||||
|
||||
OnResize (EventArgs.Empty);
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
Stop ();
|
||||
base.Close ();
|
||||
DestroyContext ();
|
||||
windowInfo.TerminateDisplay ();
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
// Stop the timer before anything else
|
||||
StopThread ();
|
||||
|
||||
if (disposing)
|
||||
OnDisposed (EventArgs.Empty);
|
||||
disposed = true;
|
||||
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
protected virtual void DestroyFrameBuffer ()
|
||||
{
|
||||
// TODO: Somehow DestroySurface is being called twice (once by SurfaceDestroyed and once by UnloadInternal->DestroyFrameBuffer)
|
||||
DestroySurface();
|
||||
}
|
||||
|
||||
public override void MakeCurrent ()
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
AssertContext ();
|
||||
try
|
||||
{
|
||||
GraphicsContext.MakeCurrent (WindowInfo);
|
||||
}
|
||||
catch (EglException e)
|
||||
{
|
||||
if (e.ErrorCode == ErrorCode.BAD_ALLOC || e.ErrorCode == ErrorCode.CONTEXT_LOST)
|
||||
{
|
||||
log(string.Format("Egl error: {0}", e.ErrorCode));
|
||||
OnContextLost(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnContextLost (EventArgs e)
|
||||
{
|
||||
base.OnContextLost (e);
|
||||
CreateContext ();
|
||||
GraphicsContext.MakeCurrent (WindowInfo);
|
||||
}
|
||||
|
||||
public override void SwapBuffers ()
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
AssertContext ();
|
||||
|
||||
if (Context != null)
|
||||
{
|
||||
Context.SwapBuffers();
|
||||
} else
|
||||
GraphicsContext.SwapBuffers ();
|
||||
}
|
||||
|
||||
double updates;
|
||||
public override void Run ()
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
updates = 0;
|
||||
#if TIMING
|
||||
targetFps = currentFps = 0;
|
||||
avgFps = 1;
|
||||
#endif
|
||||
restartCounter = 0;
|
||||
StartThread ();
|
||||
}
|
||||
|
||||
public override void Run (double updatesPerSecond)
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
#if TIMING
|
||||
avgFps = targetFps = currentFps = updatesPerSecond;
|
||||
#endif
|
||||
updates = 1000 / updatesPerSecond;
|
||||
restartCounter = 0;
|
||||
StartThread ();
|
||||
}
|
||||
|
||||
public void Stop ()
|
||||
{
|
||||
EnsureUndisposed ();
|
||||
|
||||
StopThread ();
|
||||
UnloadInternal (EventArgs.Empty);
|
||||
}
|
||||
|
||||
public virtual void Pause ()
|
||||
{
|
||||
log ("Pause");
|
||||
EnsureUndisposed ();
|
||||
PauseThread ();
|
||||
}
|
||||
|
||||
public virtual void Resume ()
|
||||
{
|
||||
log ("Resume");
|
||||
EnsureUndisposed ();
|
||||
ResumeThread ();
|
||||
}
|
||||
|
||||
#region Private
|
||||
void LoadInternal (EventArgs e)
|
||||
{
|
||||
OnLoad (e);
|
||||
}
|
||||
|
||||
void UnloadInternal (EventArgs e)
|
||||
{
|
||||
OnUnload (e);
|
||||
DestroyFrameBuffer ();
|
||||
}
|
||||
|
||||
void RenderFrameInternal (FrameEventArgs e)
|
||||
{
|
||||
#if TIMING
|
||||
Mark ();
|
||||
#endif
|
||||
if (!ReadyToRender)
|
||||
return;
|
||||
|
||||
if (autoSetContextOnRenderFrame)
|
||||
MakeCurrent ();
|
||||
|
||||
OnRenderFrame (e);
|
||||
}
|
||||
|
||||
#if TIMING
|
||||
int frames = 0;
|
||||
double prev = 0;
|
||||
double avgFps = 0;
|
||||
double currentFps = 0;
|
||||
double targetFps = 0;
|
||||
void Mark ()
|
||||
{
|
||||
double cur = stopWatch.Elapsed.TotalMilliseconds;
|
||||
if (cur < 2000) {
|
||||
return;
|
||||
}
|
||||
frames ++;
|
||||
|
||||
if (cur - prev >= 995) {
|
||||
avgFps = 0.8 * avgFps + 0.2 * frames;
|
||||
|
||||
Log.Verbose ("AndroidGameView", "frames {0} elapsed {1}ms {2:F2} fps",
|
||||
frames,
|
||||
cur - prev,
|
||||
avgFps);
|
||||
|
||||
frames = 0;
|
||||
prev = cur;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void UpdateFrameInternal (FrameEventArgs e)
|
||||
{
|
||||
if (!ReadyToRender)
|
||||
return;
|
||||
|
||||
OnUpdateFrame (e);
|
||||
}
|
||||
|
||||
void EnsureUndisposed ()
|
||||
{
|
||||
if (disposed)
|
||||
throw new ObjectDisposedException ("");
|
||||
}
|
||||
|
||||
void AssertContext ()
|
||||
{
|
||||
if (GraphicsContext == null)
|
||||
throw new InvalidOperationException ("Operation requires a GraphicsContext, which hasn't been created yet.");
|
||||
}
|
||||
|
||||
void CreateSurface()
|
||||
{
|
||||
if (GraphicsContext == null)
|
||||
{
|
||||
// First time: create context (which will create config & surface)
|
||||
CreateFrameBuffer();
|
||||
CreateContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Context already created, so only recreate the surface
|
||||
windowInfo.CreateSurface(GraphicsContext.GraphicsMode.Index.Value);
|
||||
}
|
||||
MakeCurrent();
|
||||
}
|
||||
|
||||
void DestroySurface()
|
||||
{
|
||||
log("DestroySurface");
|
||||
windowInfo.DestroySurface();
|
||||
}
|
||||
|
||||
void CreateContext ()
|
||||
{
|
||||
log ("CreateContext");
|
||||
|
||||
// Setup GraphicsMode to default if not set
|
||||
if (GraphicsMode == null)
|
||||
GraphicsMode = GraphicsMode.Default;
|
||||
|
||||
GraphicsContext = new GraphicsContext(GraphicsMode, WindowInfo, (int)ContextRenderingApi, 0, GraphicsContextFlags.Embedded);
|
||||
}
|
||||
|
||||
void DestroyContext ()
|
||||
{
|
||||
if (GraphicsContext != null) {
|
||||
GraphicsContext.Dispose ();
|
||||
GraphicsContext = null;
|
||||
}
|
||||
}
|
||||
|
||||
int restartCounter = 0;
|
||||
public int RenderThreadRestartRetries { get; set; }
|
||||
public Exception RenderThreadException;
|
||||
|
||||
void StartThread ()
|
||||
{
|
||||
log ("StartThread");
|
||||
|
||||
renderOn = true;
|
||||
stopped = false;
|
||||
callMakeCurrent = true;
|
||||
|
||||
if (source != null)
|
||||
return;
|
||||
|
||||
source = new CancellationTokenSource ();
|
||||
RenderThreadException = null;
|
||||
renderTask = Task.Factory.StartNew ((k) => {
|
||||
try {
|
||||
stopWatch = System.Diagnostics.Stopwatch.StartNew ();
|
||||
tick = 0;
|
||||
renderingThread = Thread.CurrentThread;
|
||||
var token = (CancellationToken)k;
|
||||
while (true) {
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
tick = stopWatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
pauseSignal.WaitOne ();
|
||||
|
||||
if (!RenderOnUIThread && callMakeCurrent) {
|
||||
MakeCurrent ();
|
||||
callMakeCurrent = false;
|
||||
}
|
||||
|
||||
if (RenderOnUIThread)
|
||||
global::Android.App.Application.SynchronizationContext.Send (_ => {
|
||||
RunIteration (token);
|
||||
}, null);
|
||||
else
|
||||
RunIteration (token);
|
||||
|
||||
if (updates > 0) {
|
||||
var t = updates - (stopWatch.Elapsed.TotalMilliseconds - tick);
|
||||
if (t > 0) {
|
||||
#if TIMING
|
||||
//Log.Verbose ("AndroidGameView", "took {0:F2}ms, should take {1:F2}ms, sleeping for {2:F2}", stopWatch.Elapsed.TotalMilliseconds - tick, updates, t);
|
||||
#endif
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
pauseSignal.Reset ();
|
||||
pauseSignal.WaitOne ((int)t);
|
||||
if (renderOn)
|
||||
pauseSignal.Set ();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
RenderThreadException = e;
|
||||
}
|
||||
}, source.Token).ContinueWith ((t) => {
|
||||
if (!source.IsCancellationRequested) {
|
||||
restartCounter++;
|
||||
source = null;
|
||||
if (restartCounter >= RenderThreadRestartRetries)
|
||||
OnRenderThreadExited (null);
|
||||
else {
|
||||
callMakeCurrent = true;
|
||||
StartThread ();
|
||||
}
|
||||
} else {
|
||||
restartCounter = 0;
|
||||
source = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void StopThread ()
|
||||
{
|
||||
log ("StopThread");
|
||||
restartCounter = 0;
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
stopped = true;
|
||||
renderOn = false;
|
||||
|
||||
source.Cancel ();
|
||||
|
||||
// if the render thread is paused, let it run so it exits
|
||||
pauseSignal.Set ();
|
||||
stopWatch.Stop ();
|
||||
}
|
||||
|
||||
void PauseThread ()
|
||||
{
|
||||
log ("PauseThread");
|
||||
restartCounter = 0;
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
pauseSignal.Reset ();
|
||||
renderOn = false;
|
||||
}
|
||||
|
||||
void ResumeThread ()
|
||||
{
|
||||
log ("ResumeThread");
|
||||
restartCounter = 0;
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
if (!renderOn) {
|
||||
tick = 0;
|
||||
renderOn = true;
|
||||
pauseSignal.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadyToRender {
|
||||
get { return windowInfo.HasSurface && renderOn && !stopped; }
|
||||
}
|
||||
|
||||
DateTime prevUpdateTime;
|
||||
DateTime prevRenderTime;
|
||||
DateTime curUpdateTime;
|
||||
DateTime curRenderTime;
|
||||
FrameEventArgs updateEventArgs;
|
||||
FrameEventArgs renderEventArgs;
|
||||
|
||||
// this method is called on the main thread if RenderOnUIThread is true
|
||||
void RunIteration (CancellationToken token)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
if (!ReadyToRender)
|
||||
return;
|
||||
|
||||
updateEventArgs = new FrameEventArgs ();
|
||||
curUpdateTime = DateTime.Now;
|
||||
if (prevUpdateTime.Ticks != 0) {
|
||||
var t = (curUpdateTime - prevUpdateTime).TotalSeconds;
|
||||
updateEventArgs.Time = t < 0 ? 0 : t;
|
||||
}
|
||||
|
||||
UpdateFrameInternal (updateEventArgs);
|
||||
prevUpdateTime = curUpdateTime;
|
||||
|
||||
renderEventArgs = new FrameEventArgs ();
|
||||
curRenderTime = DateTime.Now;
|
||||
if (prevRenderTime.Ticks == 0) {
|
||||
var t = (curRenderTime - prevRenderTime).TotalSeconds;
|
||||
renderEventArgs.Time = t < 0 ? 0 : t;
|
||||
}
|
||||
|
||||
RenderFrameInternal (renderEventArgs);
|
||||
prevRenderTime = curRenderTime;
|
||||
}
|
||||
|
||||
partial void log (string msg);
|
||||
|
||||
#if LOGGING
|
||||
partial void log (string msg)
|
||||
{
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("====== " + msg + " ======="));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("tid {0}", Java.Lang.Thread.CurrentThread().Id));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("stopped {0}", stopped));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("hasSurface {0}", hasSurface));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("renderOn {0}", renderOn));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("GraphicsContext? {0}", GraphicsContext != null));
|
||||
if (source != null)
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("IsCancellationRequested {0}", source.IsCancellationRequested));
|
||||
global::Android.Util.Log.Debug ("AndroidGameView", String.Format("width:{0} height:{1} size:{2} surfaceRect:{3}", Width, Height, size, surfaceRect));
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
|
||||
public bool AutoSetContextOnRenderFrame {
|
||||
get {
|
||||
return autoSetContextOnRenderFrame;
|
||||
}
|
||||
set {
|
||||
autoSetContextOnRenderFrame = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RenderOnUIThread {
|
||||
get {
|
||||
return renderOnUIThread;
|
||||
}
|
||||
set {
|
||||
renderOnUIThread = value;
|
||||
}
|
||||
}
|
||||
|
||||
GLCalls GLCalls {
|
||||
get {
|
||||
if (gl == null || gl.Version != ContextRenderingApi)
|
||||
gl = GLCalls.GetGLCalls (ContextRenderingApi);
|
||||
return gl;
|
||||
}
|
||||
}
|
||||
|
||||
IGraphicsContext Context {
|
||||
get { return GraphicsContext; }
|
||||
}
|
||||
|
||||
public GraphicsMode GraphicsMode {
|
||||
get; set;
|
||||
}
|
||||
|
||||
private Format surfaceFormat = Format.Rgb565;
|
||||
|
||||
public Format SurfaceFormat
|
||||
{
|
||||
get { return surfaceFormat; }
|
||||
set {
|
||||
if (windowInfo.HasSurface) {
|
||||
throw new InvalidOperationException("The Surface has already been created");
|
||||
}
|
||||
surfaceFormat = value;
|
||||
mHolder.SetFormat(SurfaceFormat);
|
||||
}
|
||||
}
|
||||
|
||||
GLVersion api;
|
||||
public GLVersion ContextRenderingApi
|
||||
{
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return api;
|
||||
}
|
||||
set {
|
||||
EnsureUndisposed ();
|
||||
if (GraphicsContext != null)
|
||||
throw new NotSupportedException ("Can't change RenderingApi after GraphicsContext is constructed.");
|
||||
this.api = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The visibility of the window. Always returns true.</summary>
|
||||
/// <value></value>
|
||||
/// <exception cref="T:System.ObjectDisposed">The instance has been disposed</exception>
|
||||
public new virtual bool Visible {
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return true;
|
||||
}
|
||||
set {
|
||||
EnsureUndisposed ();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets information about the containing window.</summary>
|
||||
/// <value>By default, returns an instance of <see cref="F:OpenTK.Platform.Android.AndroidWindow" /></value>
|
||||
/// <exception cref="T:System.ObjectDisposed">The instance has been disposed</exception>
|
||||
public override IWindowInfo WindowInfo {
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return windowInfo;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Always returns <see cref="F:OpenTK.WindowState.Normal" />.</summary>
|
||||
/// <value></value>
|
||||
/// <exception cref="T:System.ObjectDisposed">The instance has been disposed</exception>
|
||||
public override WindowState WindowState {
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return WindowState.Normal;
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
/// <summary>Always returns <see cref="F:OpenTK.WindowBorder.Hidden" />.</summary>
|
||||
/// <value></value>
|
||||
/// <exception cref="T:System.ObjectDisposed">The instance has been disposed</exception>
|
||||
public override WindowBorder WindowBorder {
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return WindowBorder.Hidden;
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
/// <summary>The size of the current view.</summary>
|
||||
/// <value>A <see cref="T:System.Drawing.Size" /> which is the size of the current view.</value>
|
||||
/// <exception cref="T:System.ObjectDisposed">The instance has been disposed</exception>
|
||||
public override Size Size {
|
||||
get {
|
||||
EnsureUndisposed ();
|
||||
return size;
|
||||
}
|
||||
set {
|
||||
EnsureUndisposed ();
|
||||
if (size != value) {
|
||||
size = value;
|
||||
OnResize (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
163
Source/OpenTK/Platform/Android/AndroidGraphicsContext.cs
Normal file
163
Source/OpenTK/Platform/Android/AndroidGraphicsContext.cs
Normal file
|
@ -0,0 +1,163 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using Android.Runtime;
|
||||
using Javax.Microedition.Khronos.Egl;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform.Egl;
|
||||
|
||||
namespace OpenTK.Platform.Android {
|
||||
|
||||
class AndroidGraphicsContext : EglContext
|
||||
{
|
||||
public AndroidGraphicsContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
|
||||
int major, int minor, GraphicsContextFlags flags)
|
||||
: base(mode, window, sharedContext, major, minor, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public AndroidGraphicsContext(ContextHandle handle, EglWindowInfo window, IGraphicsContext sharedContext,
|
||||
int major, int minor, GraphicsContextFlags flags)
|
||||
: base(handle, window, sharedContext, major, minor, flags)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IntPtr GetStaticAddress(IntPtr function, RenderableFlags renderable)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public class AndroidWindow : IWindowInfo, IDisposable
|
||||
{
|
||||
bool disposed;
|
||||
WeakReference refHolder;
|
||||
private EglWindowInfo eglWindowInfo;
|
||||
|
||||
// Get native window from surface
|
||||
[DllImport("android")]
|
||||
private static extern IntPtr ANativeWindow_fromSurface(IntPtr jni, IntPtr surface);
|
||||
|
||||
// Get native window from surface
|
||||
[DllImport("android")]
|
||||
private static extern void ANativeWindow_release(IntPtr surface);
|
||||
|
||||
public IntPtr Handle { get { return eglWindowInfo != null ? eglWindowInfo.Handle : IntPtr.Zero; } }
|
||||
|
||||
public bool HasSurface
|
||||
{
|
||||
get { return eglWindowInfo.Surface != IntPtr.Zero; }
|
||||
}
|
||||
|
||||
public ISurfaceHolder Holder {
|
||||
get {
|
||||
return refHolder.Target as ISurfaceHolder;
|
||||
}
|
||||
}
|
||||
public AndroidWindow (ISurfaceHolder holder)
|
||||
{
|
||||
refHolder = new WeakReference (holder);
|
||||
}
|
||||
|
||||
internal EglWindowInfo CreateEglWindowInfo()
|
||||
{
|
||||
UpdateEglWindowInfo();
|
||||
return eglWindowInfo;
|
||||
}
|
||||
|
||||
public void CreateSurface(IntPtr config)
|
||||
{
|
||||
UpdateEglWindowInfo();
|
||||
|
||||
if (refHolder.Target == null) {
|
||||
eglWindowInfo.CreatePbufferSurface(config);
|
||||
return;
|
||||
}
|
||||
|
||||
eglWindowInfo.CreateWindowSurface(config);
|
||||
}
|
||||
|
||||
private void UpdateEglWindowInfo()
|
||||
{
|
||||
if (eglWindowInfo == null)
|
||||
eglWindowInfo = new EglWindowInfo(IntPtr.Zero, IntPtr.Zero);
|
||||
|
||||
var newHandle = IntPtr.Zero;
|
||||
var holder = Holder;
|
||||
if (holder != null && holder.Surface != null)
|
||||
{
|
||||
newHandle = ANativeWindow_fromSurface(JNIEnv.Handle, holder.Surface.Handle);
|
||||
}
|
||||
|
||||
// Do we need to recreate eglWindowInfo?
|
||||
if (eglWindowInfo != null && eglWindowInfo.Handle == newHandle)
|
||||
{
|
||||
// Same, we can release this reference
|
||||
if (newHandle != IntPtr.Zero)
|
||||
ANativeWindow_release(newHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroySurface();
|
||||
|
||||
eglWindowInfo.Handle = newHandle;
|
||||
}
|
||||
}
|
||||
|
||||
public void DestroySurface ()
|
||||
{
|
||||
eglWindowInfo.DestroySurface();
|
||||
|
||||
// Release window handle
|
||||
if (eglWindowInfo.Handle != IntPtr.Zero)
|
||||
{
|
||||
ANativeWindow_release(eglWindowInfo.Handle);
|
||||
eglWindowInfo.Handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void TerminateDisplay ()
|
||||
{
|
||||
eglWindowInfo.TerminateDisplay();
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
void Dispose (bool disposing)
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
if (disposing) {
|
||||
DestroySurface ();
|
||||
TerminateDisplay ();
|
||||
refHolder = null;
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~AndroidWindow ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
59
Source/OpenTK/Platform/Android/AndroidGraphicsMode.cs
Normal file
59
Source/OpenTK/Platform/Android/AndroidGraphicsMode.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform.Android
|
||||
{
|
||||
[Obsolete("Kept for Xamarin compatibility, use GraphicsMode instead")]
|
||||
public class AndroidGraphicsMode : GraphicsMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an AndroidGraphicsMode instance with the defined settings.
|
||||
/// Defaults to EGL 1.x. To use EGL 2.0, call the
|
||||
/// <see cref="M:OpenTK.Platform.Android.AndroidGraphicsMode(Javax.Microedition.Khronos.Egl.EGLDisplay,int,OpenTK.Graphics.GraphicsMode)" />
|
||||
/// or
|
||||
/// <see cref="M:OpenTK.Platform.Android.AndroidGraphicsMode(Javax.Microedition.Khronos.Egl.EGLDisplay,int,OpenTK.Graphics.ColorFormat,int,int,int,int,bool)" />
|
||||
/// constructors (pass null to the display parameter for lazy initialization)
|
||||
/// </summary>
|
||||
public AndroidGraphicsMode(ColorFormat color, int depth, int stencil, int samples, int buffers, bool stereo) :
|
||||
this(null, 1, color, depth, stencil, samples, buffers, stereo)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an AndroidGraphicsMode instance, copying the values set in the mode parameter.
|
||||
/// Passing null to the display parameter for lazy initialization is recommended.
|
||||
/// </summary>
|
||||
/// <param name="display">
|
||||
/// A <see cref="T:Javax.Microedition.Khronos.Egl.EGLDisplay" /> with the display to use for creating the
|
||||
/// <see cref="T:Javax.Microedition.Khronos.Egl.EGLConfig" /> that represents this graphics configuration in
|
||||
/// the OpenGL space. Pass null for lazy initialization.
|
||||
/// </param>
|
||||
/// <param name="majorVersion">Requested OpenGL version (1 or 2)</param>
|
||||
/// <param name="mode">GraphicsMode to copy values from.</param>
|
||||
public AndroidGraphicsMode(object display_ignored, int majorVersion, GraphicsMode mode) :
|
||||
this(display_ignored, majorVersion, mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.Buffers, mode.Stereo)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an AndroidGraphicsMode instance with the required settings.
|
||||
/// Passing null to the display parameter for lazy initialization is recommended.
|
||||
/// </summary>
|
||||
/// <param name="display">
|
||||
/// A <see cref="T:Javax.Microedition.Khronos.Egl.EGLDisplay" /> with the display to use for creating the
|
||||
/// <see cref="T:Javax.Microedition.Khronos.Egl.EGLConfig" /> that represents this graphics configuration in
|
||||
/// the OpenGL space. Pass null for lazy initialization.
|
||||
/// </param>
|
||||
/// <param name="majorVersion">Requested OpenGL version (1 or 2)</param>
|
||||
/// <param name="color">The ColorFormat of the color buffer.</param>
|
||||
/// <param name="depth">The number of bits in the depth buffer.</param>
|
||||
/// <param name="stencil">The number of bits in the stencil buffer.</param>
|
||||
/// <param name="samples">The number of samples for FSAA.</param>
|
||||
/// <param name="stereo">Set to true for a GraphicsMode with stereographic capabilities.</param>
|
||||
/// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param>
|
||||
public AndroidGraphicsMode(object display_ignored, int majorVersion, ColorFormat color, int depth, int stencil, int samples, int buffers, bool stereo)
|
||||
: base(color, depth, stencil, samples, 0, buffers, stereo)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
18
Source/OpenTK/Platform/Android/Enums.cs
Normal file
18
Source/OpenTK/Platform/Android/Enums.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Graphics {
|
||||
public enum GLVersion {
|
||||
ES1 = 1,
|
||||
ES2 = 2,
|
||||
ES3 = 3,
|
||||
}
|
||||
}
|
74
Source/OpenTK/Platform/Android/GLCalls.cs
Normal file
74
Source/OpenTK/Platform/Android/GLCalls.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2011 Xamarin, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK.Platform.Android;
|
||||
|
||||
using All = OpenTK.Graphics.ES11.All;
|
||||
|
||||
using ES11 = OpenTK.Graphics.ES11;
|
||||
using ES20 = OpenTK.Graphics.ES20;
|
||||
using ES30 = OpenTK.Graphics.ES30;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
sealed class GLCalls
|
||||
{
|
||||
public GLVersion Version;
|
||||
|
||||
public delegate void glScissor (int x, int y, int width, int height);
|
||||
public delegate void glViewport (int x, int y, int width, int height);
|
||||
|
||||
public glScissor Scissor;
|
||||
public glViewport Viewport;
|
||||
|
||||
public static GLCalls GetGLCalls (GLVersion api)
|
||||
{
|
||||
switch (api) {
|
||||
case GLVersion.ES1:
|
||||
return CreateES1 ();
|
||||
case GLVersion.ES2:
|
||||
return CreateES2 ();
|
||||
case GLVersion.ES3:
|
||||
return CreateES3 ();
|
||||
}
|
||||
throw new ArgumentException ("api");
|
||||
}
|
||||
|
||||
public static GLCalls CreateES1 ()
|
||||
{
|
||||
return new GLCalls () {
|
||||
Version = GLVersion.ES1,
|
||||
Scissor = (x, y, w, h) => ES11.GL.Scissor(x, y, w, h),
|
||||
Viewport = (x, y, w, h) => ES11.GL.Viewport(x, y, w, h),
|
||||
};
|
||||
}
|
||||
|
||||
public static GLCalls CreateES2 ()
|
||||
{
|
||||
return new GLCalls () {
|
||||
Version = GLVersion.ES2,
|
||||
Scissor = (x, y, w, h) => ES20.GL.Scissor(x, y, w, h),
|
||||
Viewport = (x, y, w, h) => ES20.GL.Viewport(x, y, w, h),
|
||||
};
|
||||
}
|
||||
|
||||
public static GLCalls CreateES3 ()
|
||||
{
|
||||
return new GLCalls () {
|
||||
Version = GLVersion.ES3,
|
||||
Scissor = (x, y, w, h) => ES30.GL.Scissor(x, y, w, h),
|
||||
Viewport = (x, y, w, h) => ES30.GL.Viewport(x, y, w, h),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
1199
Source/OpenTK/Platform/Android/GameViewBase.cs
Normal file
1199
Source/OpenTK/Platform/Android/GameViewBase.cs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
#region License
|
||||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
|
@ -36,15 +36,19 @@ namespace OpenTK.Platform
|
|||
{
|
||||
public override void LoadAll()
|
||||
{
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
|
||||
#if OPENGL
|
||||
new OpenTK.Graphics.OpenGL.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.OpenGL4.GL().LoadEntryPoints();
|
||||
#endif
|
||||
#if OPENGLES
|
||||
new OpenTK.Graphics.ES11.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES20.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES30.GL().LoadEntryPoints();
|
||||
#endif
|
||||
|
||||
Debug.WriteLine(String.Format("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds));
|
||||
Debug.Print("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#region --- License ---
|
||||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2006-2008 the OpenTK Team.
|
||||
* This notice may not be removed from any source distribution.
|
||||
|
@ -20,7 +20,7 @@ namespace OpenTK.Platform.Dummy
|
|||
/// An empty IGraphicsContext implementation to be used inside the Visual Studio designer.
|
||||
/// This class supports OpenTK, and is not intended for use by OpenTK programs.
|
||||
/// </summary>
|
||||
internal sealed class DummyGLContext : DesktopGraphicsContext
|
||||
internal sealed class DummyGLContext : GraphicsContextBase
|
||||
{
|
||||
readonly GraphicsContext.GetAddressDelegate Loader;
|
||||
|
||||
|
@ -102,11 +102,15 @@ namespace OpenTK.Platform.Dummy
|
|||
|
||||
public override void LoadAll()
|
||||
{
|
||||
#if OPENGL
|
||||
new OpenTK.Graphics.OpenGL.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.OpenGL4.GL().LoadEntryPoints();
|
||||
#endif
|
||||
#if OPENGLES
|
||||
new OpenTK.Graphics.ES11.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES20.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES30.GL().LoadEntryPoints();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenTK.Platform.Egl
|
|||
VG = Egl.OPENVG_BIT,
|
||||
}
|
||||
|
||||
enum ErrorCode
|
||||
public enum ErrorCode
|
||||
{
|
||||
SUCCESS = 12288,
|
||||
NOT_INITIALIZED = 12289,
|
||||
|
@ -75,6 +75,7 @@ namespace OpenTK.Platform.Egl
|
|||
BAD_NATIVE_WINDOW = 12299,
|
||||
BAD_PARAMETER = 12300,
|
||||
BAD_SURFACE = 12301,
|
||||
CONTEXT_LOST = 12302,
|
||||
}
|
||||
|
||||
static partial class Egl
|
||||
|
|
|
@ -115,7 +115,10 @@ namespace OpenTK.Platform.Egl
|
|||
|
||||
public override void SwapBuffers()
|
||||
{
|
||||
Egl.SwapBuffers(WindowInfo.Display, WindowInfo.Surface);
|
||||
if (!Egl.SwapBuffers(WindowInfo.Display, WindowInfo.Surface))
|
||||
{
|
||||
throw new GraphicsContextException(string.Format("Failed to swap buffers for context {0} current. Error: {1}", this, Egl.GetError()));
|
||||
}
|
||||
}
|
||||
|
||||
public override void MakeCurrent(IWindowInfo window)
|
||||
|
@ -128,7 +131,10 @@ namespace OpenTK.Platform.Egl
|
|||
{
|
||||
if (window is EglWindowInfo)
|
||||
WindowInfo = (EglWindowInfo) window;
|
||||
Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext);
|
||||
if (!Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext))
|
||||
{
|
||||
throw new GraphicsContextException(string.Format("Failed to make context {0} current. Error: {1}", this, Egl.GetError()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
23
Source/OpenTK/Platform/Egl/EglException.cs
Normal file
23
Source/OpenTK/Platform/Egl/EglException.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
|
||||
// This file is distributed under GPL v3. See LICENSE.md for details.
|
||||
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform.Egl
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an Egl exception.
|
||||
/// </summary>
|
||||
public class EglException : GraphicsContextException
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the EGL error code.
|
||||
/// </summary>
|
||||
public ErrorCode ErrorCode { get; private set; }
|
||||
|
||||
internal EglException(string message, ErrorCode errorCode) : base(message)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -96,16 +96,32 @@ namespace OpenTK.Platform.Egl
|
|||
// Surface = Egl.CreatePixmapSurface(Display, config, Handle, null);
|
||||
//}
|
||||
|
||||
//public void CreatePbufferSurface(EGLConfig config)
|
||||
//{
|
||||
// Surface = Egl.CreatePbufferSurface(Display, config, null);
|
||||
//}
|
||||
public void CreatePbufferSurface(IntPtr config)
|
||||
{
|
||||
Surface = Egl.CreatePbufferSurface(Display, config, null);
|
||||
}
|
||||
|
||||
public void DestroySurface()
|
||||
{
|
||||
if (Surface != IntPtr.Zero)
|
||||
{
|
||||
if (Egl.GetCurrentSurface(Egl.DRAW) == Surface)
|
||||
Egl.MakeCurrent(Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
|
||||
|
||||
if (!Egl.DestroySurface(Display, Surface))
|
||||
Debug.Print("[Warning] Failed to destroy {0}:{1}.", Surface.GetType().Name, Surface);
|
||||
Surface = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void TerminateDisplay()
|
||||
{
|
||||
if (Display != IntPtr.Zero)
|
||||
{
|
||||
if (!Egl.Terminate(Display))
|
||||
Debug.Print("[Warning] Failed to terminate display {0}.", Display);
|
||||
Display = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -38,9 +38,11 @@ namespace OpenTK.Platform
|
|||
{
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
|
||||
#if OPENGLES
|
||||
new OpenTK.Graphics.ES11.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES20.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES30.GL().LoadEntryPoints();
|
||||
#endif
|
||||
|
||||
Debug.Print("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
|
|
|
@ -57,12 +57,21 @@ namespace OpenTK.Platform
|
|||
Toolkit.Init();
|
||||
|
||||
// Create regular platform backend
|
||||
#if SDL2
|
||||
if (Configuration.RunningOnSdl2) Default = new SDL2.Sdl2Factory();
|
||||
#endif
|
||||
#if WIN32
|
||||
else if (Configuration.RunningOnWindows) Default = new Windows.WinFactory();
|
||||
#endif
|
||||
#if CARBON
|
||||
else if (Configuration.RunningOnMacOS) Default = new MacOS.MacOSFactory();
|
||||
#endif
|
||||
#if X11
|
||||
else if (Configuration.RunningOnX11) Default = new X11.X11Factory();
|
||||
else if (Configuration.RunningOnLinux) Default = new Linux.LinuxFactory();
|
||||
else if (Configuration.RunningOnWindows) Default = new Windows.WinFactory();
|
||||
else if (Configuration.RunningOnMacOS) Default = new MacOS.MacOSFactory();
|
||||
else Default = new UnsupportedPlatform();
|
||||
#endif
|
||||
if (Default == null)
|
||||
Default = new UnsupportedPlatform();
|
||||
|
||||
// Create embedded platform backend for EGL / OpenGL ES.
|
||||
// Todo: we could probably delay this until the embedded
|
||||
|
@ -74,14 +83,27 @@ namespace OpenTK.Platform
|
|||
// using the same API.
|
||||
Embedded = Default;
|
||||
}
|
||||
#if IPHONE
|
||||
else if (Configuration.RunningOnIOS) Embedded = new iPhoneOS.iPhoneFactory();
|
||||
#else
|
||||
else if (Egl.Egl.IsSupported)
|
||||
{
|
||||
if (Configuration.RunningOnLinux) Embedded = Default;
|
||||
#if X11
|
||||
else if (Configuration.RunningOnX11) Embedded = new Egl.EglX11PlatformFactory();
|
||||
#endif
|
||||
#if WIN32
|
||||
else if (Configuration.RunningOnWindows) Embedded = new Egl.EglWinPlatformFactory();
|
||||
#endif
|
||||
#if CARBON
|
||||
else if (Configuration.RunningOnMacOS) Embedded = new Egl.EglMacPlatformFactory();
|
||||
#endif
|
||||
#if ANDROID
|
||||
else if (Configuration.RunningOnAndroid) Embedded = new Android.AndroidFactory();
|
||||
#endif
|
||||
else Embedded = new UnsupportedPlatform();
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
Embedded = new UnsupportedPlatform();
|
||||
|
|
|
@ -184,24 +184,38 @@ namespace OpenTK.Platform
|
|||
|
||||
internal static GraphicsContext.GetAddressDelegate CreateGetAddress()
|
||||
{
|
||||
GraphicsContext.GetAddressDelegate loader = null;
|
||||
#if SDL2
|
||||
if (Configuration.RunningOnSdl2)
|
||||
{
|
||||
return Platform.SDL2.SDL.GL.GetProcAddress;
|
||||
}
|
||||
#endif
|
||||
#if WIN32
|
||||
if (Configuration.RunningOnWindows)
|
||||
{
|
||||
loader = Platform.Windows.Wgl.GetProcAddress;
|
||||
return Platform.Windows.Wgl.GetProcAddress;
|
||||
}
|
||||
else if (Configuration.RunningOnX11)
|
||||
#endif
|
||||
#if X11
|
||||
if (Configuration.RunningOnX11)
|
||||
{
|
||||
loader = Platform.X11.Glx.GetProcAddress;
|
||||
return Platform.X11.Glx.GetProcAddress;
|
||||
}
|
||||
else if (Configuration.RunningOnMacOS)
|
||||
#endif
|
||||
#if CARBON
|
||||
if (Configuration.RunningOnMacOS)
|
||||
{
|
||||
loader = Platform.MacOS.NS.GetAddress;
|
||||
return Platform.MacOS.NS.GetAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
return loader;
|
||||
#endif
|
||||
|
||||
// Other platforms: still allow dummy contexts to be created (if no Loader is required)
|
||||
return EmptyGetAddress;
|
||||
}
|
||||
|
||||
private static IntPtr EmptyGetAddress(string function)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -243,6 +257,7 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateX11WindowInfo(IntPtr display, int screen, IntPtr windowHandle, IntPtr rootWindow, IntPtr visualInfo)
|
||||
{
|
||||
#if X11
|
||||
Platform.X11.X11WindowInfo window = new OpenTK.Platform.X11.X11WindowInfo();
|
||||
window.Display = display;
|
||||
window.Screen = screen;
|
||||
|
@ -250,6 +265,9 @@ namespace OpenTK.Platform
|
|||
window.RootWindow = rootWindow;
|
||||
window.Visual = visualInfo;
|
||||
return window;
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -263,7 +281,11 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateWindowsWindowInfo(IntPtr windowHandle)
|
||||
{
|
||||
#if WIN32
|
||||
return new OpenTK.Platform.Windows.WinWindowInfo(windowHandle, null);
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -279,9 +301,14 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateMacOSCarbonWindowInfo(IntPtr windowHandle, bool ownHandle, bool isControl)
|
||||
{
|
||||
#if CARBON
|
||||
return CreateMacOSCarbonWindowInfo(windowHandle, ownHandle, isControl, null, null);
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CARBON
|
||||
/// <summary>
|
||||
/// Creates an IWindowInfo instance for the Mac OS X platform with an X and Y offset for the GL viewport location.
|
||||
/// </summary>
|
||||
|
@ -296,6 +323,7 @@ namespace OpenTK.Platform
|
|||
{
|
||||
return new OpenTK.Platform.MacOS.CarbonWindowInfo(windowHandle, false, isControl, xOffset, yOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -309,7 +337,11 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateMacOSWindowInfo(IntPtr windowHandle)
|
||||
{
|
||||
#if CARBON
|
||||
return new OpenTK.Platform.MacOS.CocoaWindowInfo(windowHandle);
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -320,7 +352,11 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateMacOSWindowInfo(IntPtr windowHandle, IntPtr viewHandle)
|
||||
{
|
||||
#if CARBON
|
||||
return new OpenTK.Platform.MacOS.CocoaWindowInfo(windowHandle, viewHandle);
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -347,8 +383,12 @@ namespace OpenTK.Platform
|
|||
/// <returns>A new IWindowInfo instance.</returns>
|
||||
public static IWindowInfo CreateSdl2WindowInfo(IntPtr windowHandle)
|
||||
{
|
||||
#if SDL2
|
||||
return new OpenTK.Platform.SDL2.Sdl2WindowInfo(
|
||||
windowHandle, null);
|
||||
#else
|
||||
return new Dummy.DummyWindowInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
34
Source/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs
Normal file
34
Source/OpenTK/Platform/iPhoneOS/iPhoneDisplayDeviceDriver.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenTK.Platform;
|
||||
|
||||
namespace OpenTK.Platform.iPhoneOS
|
||||
{
|
||||
class AndroidDisplayDeviceDriver : IDisplayDeviceDriver
|
||||
{
|
||||
static DisplayDevice dev;
|
||||
static AndroidDisplayDeviceDriver()
|
||||
{
|
||||
dev = new DisplayDevice();
|
||||
dev.IsPrimary = true;
|
||||
dev.BitsPerPixel = 16;
|
||||
}
|
||||
|
||||
public DisplayDevice GetDisplay(DisplayIndex displayIndex)
|
||||
{
|
||||
return (displayIndex == DisplayIndex.First || displayIndex == DisplayIndex.Primary) ? dev : null;
|
||||
}
|
||||
|
||||
|
||||
public bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryRestoreResolution(DisplayDevice device)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
91
Source/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs
Normal file
91
Source/OpenTK/Platform/iPhoneOS/iPhoneFactory.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2009 the Open Toolkit library.
|
||||
// Copyright 2013 Xamarin Inc
|
||||
//
|
||||
// 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.Text;
|
||||
|
||||
using OpenGLES;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform.iPhoneOS
|
||||
{
|
||||
class iPhoneFactory : PlatformFactoryBase
|
||||
{
|
||||
#region IPlatformFactory Members
|
||||
|
||||
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
return new iPhoneOS.iPhoneOSGraphicsContext(mode, window, shareContext, major, minor, flags);
|
||||
}
|
||||
|
||||
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
return new iPhoneOS.iPhoneOSGraphicsContext(handle, window, shareContext, major, minor, flags);
|
||||
}
|
||||
|
||||
public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
|
||||
{
|
||||
return () => {
|
||||
EAGLContext c = EAGLContext.CurrentContext;
|
||||
IntPtr h = IntPtr.Zero;
|
||||
if (c != null)
|
||||
h = c.Handle;
|
||||
return new ContextHandle(h);
|
||||
};
|
||||
}
|
||||
|
||||
public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override IDisplayDeviceDriver CreateDisplayDeviceDriver()
|
||||
{
|
||||
return new AndroidDisplayDeviceDriver();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IKeyboardDriver2 CreateKeyboardDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IMouseDriver2 CreateMouseDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override OpenTK.Input.IJoystickDriver2 CreateJoystickDriver()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
1026
Source/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs
Normal file
1026
Source/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs
Normal file
File diff suppressed because it is too large
Load diff
127
Source/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs
Normal file
127
Source/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs
Normal file
|
@ -0,0 +1,127 @@
|
|||
#region --- License ---
|
||||
/* Licensed under the MIT/X11 license.
|
||||
* Copyright (c) 2009 Novell, Inc.
|
||||
* Copyright 2013 Xamarin Inc
|
||||
* This notice may not be removed from any source distribution.
|
||||
* See license.txt for licensing detailed licensing details.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
using ObjCRuntime;
|
||||
using OpenGLES;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform.iPhoneOS {
|
||||
|
||||
class iPhoneOSGraphicsContext : EmbeddedGraphicsContext
|
||||
{
|
||||
public EAGLContext EAGLContext {get; private set;}
|
||||
|
||||
internal iPhoneOSGraphicsContext(ContextHandle h)
|
||||
{
|
||||
EAGLContext = (EAGLContext) Runtime.GetNSObject(h.Handle);
|
||||
}
|
||||
|
||||
internal iPhoneOSGraphicsContext(ContextHandle handle, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
// ignore mode, window
|
||||
|
||||
iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext;
|
||||
|
||||
EAGLRenderingAPI version = 0;
|
||||
if (major == 1 && minor == 1)
|
||||
version = EAGLRenderingAPI.OpenGLES1;
|
||||
else if (major == 2 && minor == 0)
|
||||
version = EAGLRenderingAPI.OpenGLES2;
|
||||
else if (major == 3 && minor == 0)
|
||||
version = EAGLRenderingAPI.OpenGLES3;
|
||||
else
|
||||
throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor));
|
||||
|
||||
if (handle.Handle == IntPtr.Zero) {
|
||||
EAGLContext = shared != null && shared.EAGLContext != null
|
||||
? new EAGLContext(version, shared.EAGLContext.ShareGroup)
|
||||
: new EAGLContext(version);
|
||||
Handle = new ContextHandle(EAGLContext.Handle);
|
||||
} else {
|
||||
EAGLContext = (EAGLContext) Runtime.GetNSObject (handle.Handle);
|
||||
Handle = handle;
|
||||
}
|
||||
}
|
||||
|
||||
internal iPhoneOSGraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
|
||||
{
|
||||
// ignore mode, window
|
||||
|
||||
iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext;
|
||||
|
||||
EAGLRenderingAPI version = 0;
|
||||
if (major == 1 && minor == 1)
|
||||
version = EAGLRenderingAPI.OpenGLES1;
|
||||
else if (major == 2 && minor == 0)
|
||||
version = EAGLRenderingAPI.OpenGLES2;
|
||||
else if (major == 3 && minor == 0)
|
||||
version = EAGLRenderingAPI.OpenGLES3;
|
||||
else
|
||||
throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor));
|
||||
|
||||
EAGLContext = shared != null && shared.EAGLContext != null
|
||||
? new EAGLContext(version, shared.EAGLContext.ShareGroup)
|
||||
: new EAGLContext(version);
|
||||
Handle = new ContextHandle(EAGLContext.Handle);
|
||||
}
|
||||
|
||||
public override void SwapBuffers()
|
||||
{
|
||||
if (!EAGLContext.PresentRenderBuffer((uint) OpenTK.Graphics.ES11.All.RenderbufferOes))
|
||||
throw new InvalidOperationException ("EAGLContext.PresentRenderbuffer failed.");
|
||||
}
|
||||
|
||||
public override void MakeCurrent(IWindowInfo window)
|
||||
{
|
||||
if (!EAGLContext.SetCurrentContext(window != null ? EAGLContext : null))
|
||||
throw new InvalidOperationException("Unable to change current EAGLContext.");
|
||||
}
|
||||
|
||||
public override bool IsCurrent
|
||||
{
|
||||
get {return EAGLContext.CurrentContext == EAGLContext;}
|
||||
}
|
||||
|
||||
public override int SwapInterval
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
public GraphicsMode GraphicsMode {get; private set;}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (!IsDisposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (EAGLContext != null)
|
||||
EAGLContext.Dispose();
|
||||
EAGLContext = null;
|
||||
}
|
||||
IsDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~iPhoneOSGraphicsContext()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
Source/Samples/Android/ES11/Assets/AboutAssets.txt
Normal file
19
Source/Samples/Android/ES11/Assets/AboutAssets.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with your package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
72
Source/Samples/Android/ES11/ES11.csproj
Normal file
72
Source/Samples/Android/ES11/ES11.csproj
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{61E47728-8B64-442E-89EA-1FE6D2ADE654}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ES11</RootNamespace>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>ES11</AssemblyName>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__ANDROID__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__ANDROID__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>Full</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="GLView1.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\OpenTK\OpenTK.Android.csproj">
|
||||
<Project>{1648ACE1-E7D0-41CB-9A0E-C2A9D76C13A9}</Project>
|
||||
<Name>OpenTK.Android</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
109
Source/Samples/Android/ES11/GLView1.cs
Normal file
109
Source/Samples/Android/ES11/GLView1.cs
Normal file
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.ES11;
|
||||
using OpenTK.Platform;
|
||||
using OpenTK.Platform.Android;
|
||||
using Android.Views;
|
||||
using Android.Content;
|
||||
using Android.Util;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
class GLView1 : AndroidGameView
|
||||
{
|
||||
public GLView1(Context context) : base(context)
|
||||
{
|
||||
}
|
||||
// This gets called when the drawing surface is ready
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
// Run the render loop
|
||||
Run();
|
||||
}
|
||||
// This method is called everytime the context needs
|
||||
// to be recreated. Use it to set any egl-specific settings
|
||||
// prior to context creation
|
||||
//
|
||||
// In this particular case, we demonstrate how to set
|
||||
// the graphics mode and fallback in case the device doesn't
|
||||
// support the defaults
|
||||
protected override void CreateFrameBuffer()
|
||||
{
|
||||
// the default GraphicsMode that is set consists of (16, 16, 0, 0, 2, false)
|
||||
try
|
||||
{
|
||||
Log.Verbose("GLCube", "Loading with default settings");
|
||||
|
||||
// if you don't call this, the context won't be created
|
||||
base.CreateFrameBuffer();
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Verbose("GLCube", "{0}", ex);
|
||||
}
|
||||
|
||||
// this is a graphics setting that sets everything to the lowest mode possible so
|
||||
// the device returns a reliable graphics setting.
|
||||
try
|
||||
{
|
||||
Log.Verbose("GLCube", "Loading with custom Android settings (low mode)");
|
||||
GraphicsMode = new AndroidGraphicsMode(0, 0, 0, 0, 0, false);
|
||||
|
||||
// if you don't call this, the context won't be created
|
||||
base.CreateFrameBuffer();
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Verbose("GLCube", "{0}", ex);
|
||||
}
|
||||
throw new Exception("Can't load egl, aborting");
|
||||
}
|
||||
// This gets called on each frame render
|
||||
protected override void OnRenderFrame(FrameEventArgs e)
|
||||
{
|
||||
// you only need to call this if you have delegates
|
||||
// registered that you want to have called
|
||||
base.OnRenderFrame(e);
|
||||
|
||||
GL.MatrixMode(All.Projection);
|
||||
GL.LoadIdentity();
|
||||
GL.Ortho(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
|
||||
GL.MatrixMode(All.Modelview);
|
||||
GL.Rotate(3.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
GL.ClearColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
|
||||
GL.VertexPointer(2, All.Float, 0, square_vertices);
|
||||
GL.EnableClientState(All.VertexArray);
|
||||
GL.ColorPointer(4, All.UnsignedByte, 0, square_colors);
|
||||
GL.EnableClientState(All.ColorArray);
|
||||
|
||||
GL.DrawArrays(All.TriangleStrip, 0, 4);
|
||||
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
float[] square_vertices =
|
||||
{
|
||||
-0.5f, -0.5f,
|
||||
0.5f, -0.5f,
|
||||
-0.5f, 0.5f,
|
||||
0.5f, 0.5f,
|
||||
};
|
||||
byte[] square_colors =
|
||||
{
|
||||
255, 255, 0, 255,
|
||||
0, 255, 255, 255,
|
||||
0, 0, 0, 0,
|
||||
255, 0, 255, 255,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
51
Source/Samples/Android/ES11/MainActivity.cs
Normal file
51
Source/Samples/Android/ES11/MainActivity.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
// the ConfigurationChanges flags set here keep the EGL context
|
||||
// from being destroyed whenever the device is rotated or the
|
||||
// keyboard is shown (highly recommended for all GL apps)
|
||||
[Activity(Label = "ES11",
|
||||
#if __ANDROID_11__
|
||||
HardwareAccelerated=false,
|
||||
#endif
|
||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
|
||||
MainLauncher = true)]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
GLView1 view;
|
||||
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
base.OnCreate(bundle);
|
||||
|
||||
// Create our OpenGL view, and display it
|
||||
view = new GLView1(this);
|
||||
SetContentView(view);
|
||||
}
|
||||
|
||||
protected override void OnPause()
|
||||
{
|
||||
// never forget to do this!
|
||||
base.OnPause();
|
||||
view.Pause();
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
// never forget to do this!
|
||||
base.OnResume();
|
||||
view.Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="ES11.ES11">
|
||||
<uses-sdk />
|
||||
<application android:label="ES11">
|
||||
</application>
|
||||
</manifest>
|
23
Source/Samples/Android/ES11/Properties/AssemblyInfo.cs
Normal file
23
Source/Samples/Android/ES11/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle("ES11")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Stefanos Apostolopoulos")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
44
Source/Samples/Android/ES11/Resources/AboutResources.txt
Normal file
44
Source/Samples/Android/ES11/Resources/AboutResources.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
93
Source/Samples/Android/ES11/Resources/Resource.designer.cs
generated
Normal file
93
Source/Samples/Android/ES11/Resources/Resource.designer.cs
generated
Normal file
|
@ -0,0 +1,93 @@
|
|||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("ES11.Resource", IsApplication=true)]
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
static Resource()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
static Attribute()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Drawable
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int app_name = 2130968576;
|
||||
|
||||
static String()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
BIN
Source/Samples/Android/ES11/Resources/drawable/Icon.png
Normal file
BIN
Source/Samples/Android/ES11/Resources/drawable/Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
8
Source/Samples/Android/ES11/Resources/layout/Main.axml
Normal file
8
Source/Samples/Android/ES11/Resources/layout/Main.axml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
</LinearLayout>
|
||||
|
4
Source/Samples/Android/ES11/Resources/values/Strings.xml
Normal file
4
Source/Samples/Android/ES11/Resources/values/Strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">ES11</string>
|
||||
</resources>
|
42
Source/Samples/iOS/ES11/AppDelegate.cs
Normal file
42
Source/Samples/iOS/ES11/AppDelegate.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
public override UIWindow Window
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
// This method is invoked when the application is about to move from active to inactive state.
|
||||
// OpenGL applications should use this method to pause.
|
||||
public override void OnResignActivation(UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method should be used to release shared resources and it should store the application state.
|
||||
// If your application supports background exection this method is called instead of WillTerminate
|
||||
// when the user quits.
|
||||
public override void DidEnterBackground(UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method is called as part of the transiton from background to active state.
|
||||
public override void WillEnterForeground(UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method is called when the application is about to terminate. Save data, if needed.
|
||||
public override void WillTerminate(UIApplication application)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
351
Source/Samples/iOS/ES11/EAGLView.cs
Normal file
351
Source/Samples/iOS/ES11/EAGLView.cs
Normal file
|
@ -0,0 +1,351 @@
|
|||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.ES20;
|
||||
using GL1 = OpenTK.Graphics.ES11.GL;
|
||||
using All1 = OpenTK.Graphics.ES11.All;
|
||||
using OpenTK.Platform.iPhoneOS;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using ObjCRuntime;
|
||||
using OpenGLES;
|
||||
using UIKit;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
[Register("EAGLView")]
|
||||
public class EAGLView : iPhoneOSGameView
|
||||
{
|
||||
[Export("initWithCoder:")]
|
||||
public EAGLView(NSCoder coder) : base(coder)
|
||||
{
|
||||
LayerRetainsBacking = true;
|
||||
LayerColorFormat = EAGLColorFormat.RGBA8;
|
||||
}
|
||||
|
||||
[Export("layerClass")]
|
||||
public static new Class GetLayerClass()
|
||||
{
|
||||
return iPhoneOSGameView.GetLayerClass();
|
||||
}
|
||||
|
||||
protected override void ConfigureLayer(CAEAGLLayer eaglLayer)
|
||||
{
|
||||
eaglLayer.Opaque = true;
|
||||
}
|
||||
|
||||
protected override void CreateFrameBuffer()
|
||||
{
|
||||
try
|
||||
{
|
||||
ContextRenderingApi = EAGLRenderingAPI.OpenGLES2;
|
||||
base.CreateFrameBuffer();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Diagnostics.Debug.Print(e.ToString());
|
||||
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
|
||||
base.CreateFrameBuffer();
|
||||
}
|
||||
|
||||
if (ContextRenderingApi == EAGLRenderingAPI.OpenGLES2)
|
||||
LoadShaders();
|
||||
}
|
||||
|
||||
protected override void DestroyFrameBuffer()
|
||||
{
|
||||
base.DestroyFrameBuffer();
|
||||
DestroyShaders();
|
||||
}
|
||||
|
||||
#region DisplayLink support
|
||||
|
||||
int frameInterval;
|
||||
CADisplayLink displayLink;
|
||||
|
||||
public bool IsAnimating { get; private set; }
|
||||
// How many display frames must pass between each time the display link fires.
|
||||
public int FrameInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return frameInterval;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
throw new ArgumentException();
|
||||
frameInterval = value;
|
||||
if (IsAnimating)
|
||||
{
|
||||
StopAnimating();
|
||||
StartAnimating();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAnimating()
|
||||
{
|
||||
if (IsAnimating)
|
||||
return;
|
||||
|
||||
CreateFrameBuffer();
|
||||
displayLink = UIScreen.MainScreen.CreateDisplayLink(this, new Selector("drawFrame"));
|
||||
displayLink.FrameInterval = frameInterval;
|
||||
displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode);
|
||||
|
||||
IsAnimating = true;
|
||||
}
|
||||
|
||||
public void StopAnimating()
|
||||
{
|
||||
if (!IsAnimating)
|
||||
return;
|
||||
|
||||
displayLink.Invalidate();
|
||||
displayLink = null;
|
||||
DestroyFrameBuffer();
|
||||
IsAnimating = false;
|
||||
}
|
||||
|
||||
[Export("drawFrame")]
|
||||
void DrawFrame()
|
||||
{
|
||||
OnRenderFrame(new FrameEventArgs());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
static readonly float[] squareVertices =
|
||||
{
|
||||
-0.5f, -0.33f,
|
||||
0.5f, -0.33f,
|
||||
-0.5f, 0.33f,
|
||||
0.5f, 0.33f,
|
||||
};
|
||||
static readonly byte[] squareColors =
|
||||
{
|
||||
255, 255, 0, 255,
|
||||
0, 255, 255, 255,
|
||||
0, 0, 0, 0,
|
||||
255, 0, 255, 255,
|
||||
};
|
||||
static float transY = 0.0f;
|
||||
const int UNIFORM_TRANSLATE = 0;
|
||||
const int UNIFORM_COUNT = 1;
|
||||
readonly int[] uniforms = new int [UNIFORM_COUNT];
|
||||
const int ATTRIB_VERTEX = 0;
|
||||
const int ATTRIB_COLOR = 1;
|
||||
const int ATTRIB_COUNT = 2;
|
||||
int program;
|
||||
|
||||
protected override void OnRenderFrame(FrameEventArgs e)
|
||||
{
|
||||
base.OnRenderFrame(e);
|
||||
|
||||
MakeCurrent();
|
||||
|
||||
// Replace the implementation of this method to do your own custom drawing.
|
||||
GL.ClearColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
|
||||
if (ContextRenderingApi == EAGLRenderingAPI.OpenGLES2)
|
||||
{
|
||||
// Use shader program.
|
||||
GL.UseProgram(program);
|
||||
|
||||
// Update uniform value.
|
||||
GL.Uniform1(uniforms[UNIFORM_TRANSLATE], transY);
|
||||
transY += 0.075f;
|
||||
|
||||
// Update attribute values.
|
||||
GL.VertexAttribPointer(ATTRIB_VERTEX, 2, VertexAttribPointerType.Float, false, 0, squareVertices);
|
||||
GL.EnableVertexAttribArray(ATTRIB_VERTEX);
|
||||
GL.VertexAttribPointer(ATTRIB_COLOR, 4, VertexAttribPointerType.UnsignedByte, true, 0, squareColors);
|
||||
GL.EnableVertexAttribArray(ATTRIB_COLOR);
|
||||
|
||||
// Validate program before drawing. This is a good check, but only really necessary in a debug build.
|
||||
#if DEBUG
|
||||
if (!ValidateProgram (program)) {
|
||||
Console.WriteLine ("Failed to validate program {0:x}", program);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
GL1.MatrixMode(All1.Projection);
|
||||
GL1.LoadIdentity();
|
||||
GL1.MatrixMode(All1.Modelview);
|
||||
GL1.LoadIdentity();
|
||||
GL1.Translate(0.0f, (float)Math.Sin(transY) / 2.0f, 0.0f);
|
||||
transY += 0.075f;
|
||||
|
||||
GL1.VertexPointer(2, All1.Float, 0, squareVertices);
|
||||
GL1.EnableClientState(All1.VertexArray);
|
||||
GL1.ColorPointer(4, All1.UnsignedByte, 0, squareColors);
|
||||
GL1.EnableClientState(All1.ColorArray);
|
||||
}
|
||||
|
||||
GL.DrawArrays(BeginMode.TriangleStrip, 0, 4);
|
||||
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
bool LoadShaders()
|
||||
{
|
||||
int vertShader, fragShader;
|
||||
|
||||
// Create shader program.
|
||||
program = GL.CreateProgram();
|
||||
|
||||
// Create and compile vertex shader.
|
||||
var vertShaderPathname = NSBundle.MainBundle.PathForResource("Shader", "vsh");
|
||||
if (!CompileShader(ShaderType.VertexShader, vertShaderPathname, out vertShader))
|
||||
{
|
||||
Console.WriteLine("Failed to compile vertex shader");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and compile fragment shader.
|
||||
var fragShaderPathname = NSBundle.MainBundle.PathForResource("Shader", "fsh");
|
||||
if (!CompileShader(ShaderType.FragmentShader, fragShaderPathname, out fragShader))
|
||||
{
|
||||
Console.WriteLine("Failed to compile fragment shader");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attach vertex shader to program.
|
||||
GL.AttachShader(program, vertShader);
|
||||
|
||||
// Attach fragment shader to program.
|
||||
GL.AttachShader(program, fragShader);
|
||||
|
||||
// Bind attribute locations.
|
||||
// This needs to be done prior to linking.
|
||||
GL.BindAttribLocation(program, ATTRIB_VERTEX, "position");
|
||||
GL.BindAttribLocation(program, ATTRIB_COLOR, "color");
|
||||
|
||||
// Link program.
|
||||
if (!LinkProgram(program))
|
||||
{
|
||||
Console.WriteLine("Failed to link program: {0:x}", program);
|
||||
|
||||
if (vertShader != 0)
|
||||
GL.DeleteShader(vertShader);
|
||||
|
||||
if (fragShader != 0)
|
||||
GL.DeleteShader(fragShader);
|
||||
|
||||
if (program != 0)
|
||||
{
|
||||
GL.DeleteProgram(program);
|
||||
program = 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get uniform locations.
|
||||
uniforms[UNIFORM_TRANSLATE] = GL.GetUniformLocation(program, "translate");
|
||||
|
||||
// Release vertex and fragment shaders.
|
||||
if (vertShader != 0)
|
||||
{
|
||||
GL.DetachShader(program, vertShader);
|
||||
GL.DeleteShader(vertShader);
|
||||
}
|
||||
|
||||
if (fragShader != 0)
|
||||
{
|
||||
GL.DetachShader(program, fragShader);
|
||||
GL.DeleteShader(fragShader);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DestroyShaders()
|
||||
{
|
||||
if (program != 0)
|
||||
{
|
||||
GL.DeleteProgram(program);
|
||||
program = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#region Shader utilities
|
||||
|
||||
static bool CompileShader(ShaderType type, string file, out int shader)
|
||||
{
|
||||
string src = System.IO.File.ReadAllText(file);
|
||||
|
||||
shader = GL.CreateShader(type);
|
||||
GL.ShaderSource(shader, 1, new string[] { src }, (int[])null);
|
||||
GL.CompileShader(shader);
|
||||
|
||||
#if DEBUG
|
||||
int logLength;
|
||||
GL.GetShader (shader, ShaderParameter.InfoLogLength, out logLength);
|
||||
if (logLength > 0) {
|
||||
var infoLog = new System.Text.StringBuilder ();
|
||||
GL.GetShaderInfoLog (shader, logLength, out logLength, infoLog);
|
||||
Console.WriteLine ("Shader compile log:\n{0}", infoLog);
|
||||
}
|
||||
#endif
|
||||
int status;
|
||||
GL.GetShader(shader, ShaderParameter.CompileStatus, out status);
|
||||
if (status == 0)
|
||||
{
|
||||
GL.DeleteShader(shader);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool LinkProgram(int program)
|
||||
{
|
||||
GL.LinkProgram(program);
|
||||
|
||||
#if DEBUG
|
||||
int logLength;
|
||||
GL.GetProgram (program, ProgramParameter.InfoLogLength, out logLength);
|
||||
if (logLength > 0) {
|
||||
var infoLog = new System.Text.StringBuilder ();
|
||||
GL.GetProgramInfoLog (program, logLength, out logLength, infoLog);
|
||||
Console.WriteLine ("Program link log:\n{0}", infoLog);
|
||||
}
|
||||
#endif
|
||||
int status;
|
||||
GL.GetProgram(program, ProgramParameter.LinkStatus, out status);
|
||||
if (status == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ValidateProgram(int program)
|
||||
{
|
||||
GL.ValidateProgram(program);
|
||||
|
||||
int logLength;
|
||||
GL.GetProgram(program, ProgramParameter.InfoLogLength, out logLength);
|
||||
if (logLength > 0)
|
||||
{
|
||||
var infoLog = new System.Text.StringBuilder();
|
||||
GL.GetProgramInfoLog(program, logLength, out logLength, infoLog);
|
||||
Console.WriteLine("Program validate log:\n{0}", infoLog);
|
||||
}
|
||||
|
||||
int status;
|
||||
GL.GetProgram(program, ProgramParameter.LinkStatus, out status);
|
||||
if (status == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
126
Source/Samples/iOS/ES11/ES11.csproj
Normal file
126
Source/Samples/iOS/ES11/ES11.csproj
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectGuid>{7848ED9E-A937-4FDA-96DC-3B5B0EA27C59}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ES11</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>ES11</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>Full</MtouchLink>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchI18n>
|
||||
</MtouchI18n>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<IpaPackageName>
|
||||
</IpaPackageName>
|
||||
<MtouchI18n>
|
||||
</MtouchI18n>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<BuildIpa>true</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\Default-568h%402x.png" />
|
||||
<BundleResource Include="Shader.fsh" />
|
||||
<BundleResource Include="Shader.vsh" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="OpenGLViewController.cs" />
|
||||
<Compile Include="EAGLView.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="MainStoryboard_iPhone.storyboard" />
|
||||
<InterfaceDefinition Include="MainStoryboard_iPad.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\OpenTK\OpenTK.iOS.csproj">
|
||||
<Project>{88368190-E3DF-4EBE-ACAA-7B1779F376CA}</Project>
|
||||
<Name>OpenTK.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
6
Source/Samples/iOS/ES11/Entitlements.plist
Normal file
6
Source/Samples/iOS/ES11/Entitlements.plist
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
44
Source/Samples/iOS/ES11/Info.plist
Normal file
44
Source/Samples/iOS/ES11/Info.plist
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>ES11</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.your-company.ES11</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>MainStoryboard_iPhone</string>
|
||||
<key>UIMainStoryboardFile~ipad</key>
|
||||
<string>MainStoryboard_iPad</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
20
Source/Samples/iOS/ES11/Main.cs
Normal file
20
Source/Samples/iOS/ES11/Main.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
26
Source/Samples/iOS/ES11/MainStoryboard_iPad.storyboard
Normal file
26
Source/Samples/iOS/ES11/MainStoryboard_iPad.storyboard
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BV1-FR-VrT">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--class Prefix:identifier View Controller-->
|
||||
<scene sceneID="tXr-a1-R10">
|
||||
<objects>
|
||||
<glkViewController preferredFramesPerSecond="30" id="BV1-FR-VrT" customClass="OpenGLViewController" sceneMemberID="viewController">
|
||||
<glkView key="view" contentMode="scaleToFill" id="3se-qz-xqx" customClass="EAGLView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</glkView>
|
||||
</glkViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<nil key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
26
Source/Samples/iOS/ES11/MainStoryboard_iPhone.storyboard
Normal file
26
Source/Samples/iOS/ES11/MainStoryboard_iPhone.storyboard
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="LVB-YS-i5n">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--class Prefix:identifier View Controller-->
|
||||
<scene sceneID="CtS-rA-C9T">
|
||||
<objects>
|
||||
<glkViewController preferredFramesPerSecond="30" id="LVB-YS-i5n" customClass="OpenGLViewController" sceneMemberID="viewController">
|
||||
<glkView key="view" contentMode="scaleToFill" id="bdc-N1-crn" customClass="EAGLView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</glkView>
|
||||
</glkViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="btX-cZ-eVz" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<nil key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
71
Source/Samples/iOS/ES11/OpenGLViewController.cs
Normal file
71
Source/Samples/iOS/ES11/OpenGLViewController.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.ES20;
|
||||
using OpenTK.Platform.iPhoneOS;
|
||||
using Foundation;
|
||||
using CoreAnimation;
|
||||
using ObjCRuntime;
|
||||
using OpenGLES;
|
||||
using UIKit;
|
||||
|
||||
namespace ES11
|
||||
{
|
||||
|
||||
[Register("OpenGLViewController")]
|
||||
public partial class OpenGLViewController : UIViewController
|
||||
{
|
||||
public OpenGLViewController(IntPtr handle) : base(handle)
|
||||
{
|
||||
}
|
||||
|
||||
new EAGLView View { get { return (EAGLView)base.View; } }
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillResignActiveNotification, a =>
|
||||
{
|
||||
if (IsViewLoaded && View.Window != null)
|
||||
View.StopAnimating();
|
||||
}, this);
|
||||
NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, a =>
|
||||
{
|
||||
if (IsViewLoaded && View.Window != null)
|
||||
View.StartAnimating();
|
||||
}, this);
|
||||
NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillTerminateNotification, a =>
|
||||
{
|
||||
if (IsViewLoaded && View.Window != null)
|
||||
View.StopAnimating();
|
||||
}, this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
NSNotificationCenter.DefaultCenter.RemoveObserver(this);
|
||||
}
|
||||
|
||||
public override void DidReceiveMemoryWarning()
|
||||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning();
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
base.ViewWillAppear(animated);
|
||||
View.StartAnimating();
|
||||
}
|
||||
|
||||
public override void ViewWillDisappear(bool animated)
|
||||
{
|
||||
base.ViewWillDisappear(animated);
|
||||
View.StopAnimating();
|
||||
}
|
||||
}
|
||||
}
|
BIN
Source/Samples/iOS/ES11/Resources/Default-568h@2x.png
Normal file
BIN
Source/Samples/iOS/ES11/Resources/Default-568h@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
6
Source/Samples/iOS/ES11/Shader.fsh
Normal file
6
Source/Samples/iOS/ES11/Shader.fsh
Normal file
|
@ -0,0 +1,6 @@
|
|||
varying lowp vec4 colorVarying;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = colorVarying;
|
||||
}
|
14
Source/Samples/iOS/ES11/Shader.vsh
Normal file
14
Source/Samples/iOS/ES11/Shader.vsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
attribute vec4 position;
|
||||
attribute vec4 color;
|
||||
|
||||
varying vec4 colorVarying;
|
||||
|
||||
uniform float translate;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = position;
|
||||
gl_Position.y += sin(translate) / 2.0;
|
||||
|
||||
colorVarying = color;
|
||||
}
|
Loading…
Reference in a new issue