mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 15:25:31 +00:00
Removed OpenTK Samples
This commit is contained in:
parent
b1b543849e
commit
ec36b5754c
|
@ -1,19 +0,0 @@
|
||||||
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");
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,109 +0,0 @@
|
||||||
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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,23 +0,0 @@
|
||||||
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("")]
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
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.
|
|
|
@ -1,93 +0,0 @@
|
||||||
#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
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
|
@ -1,8 +0,0 @@
|
||||||
<?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>
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">ES11</string>
|
|
||||||
</resources>
|
|
|
@ -1,42 +0,0 @@
|
||||||
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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,351 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,44 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,20 +0,0 @@
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,71 +0,0 @@
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
|
@ -1,6 +0,0 @@
|
||||||
varying lowp vec4 colorVarying;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = colorVarying;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
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