我可以删除Xamarin版本的OpenTK并使用另一个版本吗? [英] Can I remove the Xamarin version of OpenTK and use another?

查看:162
本文介绍了我可以删除Xamarin版本的OpenTK并使用另一个版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了适用于Mac的Visual Studio,并创建了一个跨平台解决方案.我要使用OpenTK v2(而不是xamarin随附的版本).

I've down loaded visual studio for mac and have created a cross platform solution. I want to use OpenTK v2 (not the one supplied with xamarin).

问题在于,即使未引用Xamarin.Mac,似乎也存在用于运行Xamarin.Mac的OpenTK命名空间.即使参考中未显示参考,类型(Vector4等)和Math Helper类也会显示在我的解决方案中.

The problem is that there appears to be an OpenTK namespace that is used run the Xamarin.Mac even when it isn't referenced. The types (Vector4 etc) and the Math Helper class show up in my solution even if the reference isn't showing in the references section.

当我将OpenTK v2 .dll添加到软件包(来自nuget)时,出现错误,提示多次定义了导入类型'Opentk.Vector3'(或任何类型)".一次在OpenTk中,另一次在Xamarin.mac(v0)中.

When I add the OpenTK v2 .dll to the packages (from nuget) I get errors saying 'The imported type 'Opentk.Vector3' (or whatever the type) is defined multiple times. Once in OpenTk and the other in Xamarin.mac (v0).

我已经删除了对Xamarin.Mac的引用,并且错误消失了,但是然后我当然收到了错误消息,说我不能使用CoreGraphics等.

I've deleted the reference to Xamarin.Mac and the error goes away, but then of course I get errors saying I can't use CoreGraphics etc.

是否有某种方法可以指定您的意思?还是删除不应该真正存在的对OpenTK的引用?

Is there some way of specifying which type you mean? Or removing the references to OpenTK that shouldn't really be there?

我已经尝试过OpenTK.Matrix4 mat = new OpenTK.Matrix4(),但它仍然不喜欢它.

Ive tried OpenTK.Matrix4 mat = new OpenTK.Matrix4() but it still doesn't like it.

推荐答案

1)为引用的程序集(引用属性)设置Alias:

1) Set an Alias for the referenced assembly (reference properties):

2)在源文件顶部添加extern alias:

2) Add an extern alias to the top of your source file(s):

extern alias OpenTK2;

3)然后,您可以使用using alias或完全限定的名称:

3) You can then use a using alias or the fully qualified name:

using AlphaFunction = OpenTK2::OpenTK.Graphics.OpenGL.AlphaFunction;
~~~

var alpha = AlphaFunction.Always;
alpha = OpenTK2::OpenTK.Graphics.OpenGL.AlphaFunction.Equal

这篇关于我可以删除Xamarin版本的OpenTK并使用另一个版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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