Android和iOS版本的OpenTK是否具有相同的API? [英] Do the Android and iOS versions of OpenTK have the same API?

查看:141
本文介绍了Android和iOS版本的OpenTK是否具有相同的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Xamarin进行手机游戏开发;我正在使用OpenTK进行渲染.
我的计划如下:
1.制作一个实际上是游戏的共享库(并包含所有openTK代码).
2.制作一个适用于iOS和Android的可运行项目,以处理平台特定的内容(例如弹出警报)并使用我的共享库.

I'm trying to get into mobile game development with Xamarin; I am using OpenTK for rendering.
My plan is the following:
1. Make a shared library that is actually the game (and has all openTK code).
2. Make a a runnable project for iOS and Android that handles platform specific stuff (e.g. popping up alerts) and uses my shared library.

openTK有可能吗?它在iOS和Android上是否具有完全相同的API,只是链接库不同?如果可以,如何避免代码重复?

Is this possible with openTK? Does it have exactly the same API on iOS and on Android, just the linked library is different? If yes, how to avoid code duplication?

推荐答案

您的方法听起来很合理,并且会花一点力气.

Your approach sounds very reasonable and will work with a little bit of effort.

原因是Xamarin.Android和Xamarin.iOS是从库的Alpha版本派生的,并且演进了稍微不同的API.大部分OpenGL ES绑定都是相同的,但是某些功能具有令人讨厌(且不必要)的区别,您需要在共享库中#ifdef.

The reason is that Xamarin.Android and Xamarin.iOS were forked from an alpha version of the library and have evolved slightly different APIs. Much of the OpenGL ES binding is identical, but some functions have annoying (and unnecessary) differences that you will need to #ifdef in your shared library.

好消息是OpenTK的Xamarin分支现已开源,因此我们正在积极寻求解决方案.我已经拥有一个私有库,可以在Android和桌面平台之间公开相同的OpenGL ES API [1],并且我正在努力解决iOS和Android版本之间的差异.

The good news is that the Xamarin fork of OpenTK has now been open-sourced, so we are actively working towards a solution. I already have a private build of library that exposes an identical OpenGL ES API between Android and desktop platforms[1] and I'm working on fixing the differences between the iOS and Android versions.

您可以在官方github存储库中关注OpenTK的开发.

You can follow the development of OpenTK in the official github repository.

[1]您可以使用 ANGLE ARB_ES2_compatibility

[1] You can execute OpenGL ES code on the desktop using ANGLE or the ARB_ES2_compatibility and ARB_ES3_compatibility extensions. This makes OpenGL ES the first graphics API to work across all major platforms (Windows, Linux, Mac, Android, iOS - and hopefully WinPhone in the future.)

这篇关于Android和iOS版本的OpenTK是否具有相同的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆