rehven's picture

Building apps for PC... and Android?

I've been using OpenTK for a while now, to make personal projects that run only on the Windows PC platform. I've also read a lot of the forum, but have been unable to find a definitive answer to a question: Is it possible to recompile my projects and push them to Android? I know that both platforms use OpenGL, so switch-casing platform information allows me to determine extensions and so on.

But this is one of those cases where "you don't know what you don't know", so I thought I'd ask users in general. What should I be looking out for? Are there any issues that absolutely cannot be solved when building a Windows project for Android? What don't I know about this process?

Many thanks for your advice.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
yehiyam's picture

you can use Xamarin for Android. It allows you to build and deploy C# code on android devices.
they have a free starter edition to get started.
Without xamarin, I'm not aware of another way

the Fiddler's picture

Exactly. Xamarin.Android and Xamarin.iOS ship with OpenTK out of the box.

Do note that mobile devices use OpenGL ES, not OpenGL, so you will need to use OpenTK.Graphics.[ES11|20|30] there. You can also run OpenGL ES on Windows via the ANGLE project. A prebuilt version can be found under opentk/Dependencies/[x86|x64] (simply copy the dlls to your application directory.)

Edit: there are other ways to run C# on smartphones, such as Dot42, but I haven't tested OpenTK with those yet. Xamarin is currently the most mature solution.