2013-01-03 25 views
2

如果我没有理解事物正确的,苹果的OpenGL ES 2.0的实现会使用的OpenGL ES 3.0的一些方法,例如呼叫苹果专用的OpenGL通过MonoTouch的命令/ OpenTK

glBindVertexArrayAPPLE 

glBindVertexArrayOES 

代替的

glBindVertexArray 

看来,随着MonoTouch doe交付的OpenTK编译不包括这些方法中的任何一种,尽管它们存在OpenTK绑定,例如参见http://www.opentk.com/files/doc/_g_l_core_8cs_source.html的第229行。

有什么办法可以在MonoTouch中使用这些功能吗?也许某种方式通过P/Invoke调用它们?

回答

3

为了把事情说清楚,OpenTK-1.0.dll自2012年初与MonoTouch的为运(无需安装任何东西),支持glBindVertexArrayOES致电:

GL.Oes.BindVertexArray([u]int); 

无需额外的P/Invoke在用户代码中必需的。至于glBindVertexArrayAPPLE,这将逻辑可作为:

GL.Apple.BindVertexArray([u]int); 

它是因为GL_APPLE_vertex_array_object不在的glext.h iOS版本定义(如它是具有相同的OSX版本的API 部分文件)。请注意,GL_OES_vertex_array_object在iOS和OSX版本glext.h中都有定义,这就是为什么Oes API可用。

快速grep(查找所有发生)未显示任何.dylib中的符号(因此添加它或p /调用它将在运行时失败)。

+0

谢谢,这很有道理。如果'OpenTK-1.0.dll'与MonoTouch一起发布,也许你应该给它一个不是0.0.0.0的版本号(在我的安装中显示为0.0.0.0)。干杯! – cheeesus

1

就是这样:

[DllImport(Constants.OpenGLESLibrary, EntryPoint="glGenVertexArraysOES")] 
public extern static void GenVertexArrays(int n, out int id); 

[DllImport(Constants.OpenGLESLibrary, EntryPoint="glBindVertexArrayOES")] 
public extern static void BindVertexArray(int id); 

还有很多类似的这两个功能。 @Xamarin,也许他们可以被包含在下一个MonoTouch发布中?

+0

我看到'glBindVertexArray'都是'glBindVertexArrayAPPLE'而不是'glBindVertexArrayOES'。我会添加它们(让我们知道如果你发现任何其他发行件通过bugzilla)。谢谢! – poupou

+1

罗尔夫*如果有点不准确*。 p/invoke本身在'OpenTK-1.0.dll'中,但它是'internal'而不是'public'。但是你应该可以通过使用'GL.Oes.BindVertexArray(int)'来达到它。 – poupou

+0

谢谢,我会的,但奇怪的是我没有看到'glBindVertexArrayAPPLE'。我在Mono 2.10.9和MonoTouch 6.0.8上使用MD 3.0.6,但是我的OpenTK-1.0.dll版本为0.0.0.0。请查看此屏幕截图:https://dl.dropbox.com/u/35614983/opentk_0000.png如何安装当前版本的OpenTK?不是用MonoTouch自动安装吗? – cheeesus

1

如果你参考OpenTK-1.0而不是OpenTK,你会在那里找到这个API。

+0

我正在使用OpenTK-1.0.dll,但它不存在,我必须手动p /调用它。我正在使用最新的MonoTouch/MonoDevelop版本,仅在几天前我收到了更新。 – cheeesus