简体   繁体   English

C#。 OpenTK与OpenGL相同的代码?

[英]C#. OpenTK same code as OpenGL?

I'm thinking about learning OpenGL with C# and i'm planning to use OpenTK. 我正在考虑用C#学习OpenGL,我打算使用OpenTK。 I'm wondering if the code is the same for OpenTK and "real OpenGL"?. 我想知道OpenTK和“真正的OpenGL”的代码是否相同? Do i have to read books/tutorials on OpenTK or can i read about OpenGL and still learn to code with it in C#? 我是否必须阅读有关OpenTK的书籍/教程,或者我是否可以阅读有关OpenGL的内容并仍然学会用C#编写代码?

I'd say learn OpenGL, then check out some of the minor differences between C++/OpenGL and C#/OpenTK on their website. 我会说学习OpenGL,然后在他们的网站上查看C ++ / OpenGL和C#/ OpenTK之间的一些细微差别。 As I stated the differences are overall minor, and OpenTK will only make things easier for you, it won't make them more complicated. 正如我所说,差异总体上是次要的,而OpenTK只会让事情变得更容易,但不会让它们变得更复杂。

Also what I've noticed about OpenTK, is that they are trying to make some of the basic types look like XNA. 我也注意到OpenTK,他们试图使一些基本类型看起来像XNA。 Ie, you'll find glVertex3f(float, float, float); 即,你会发现glVertex3f(float,float,float); in OpenGL/C++, which you can write like GL.Vertex3(Vector3); 在OpenGL / C ++中,您可以像GL.Vertex3(Vector3)一样编写; , of which they 'stole' the Vector3 data type from XNA (although you're not required to do this with a Vector3), so with things like that it might be handy to read some of the OpenTK documentation. ,他们从XNA中偷走了Vector3数据类型(虽然你不需要用Vector3做这个),所以有了这样的东西,读一些OpenTK文档可能会很方便。 Although this is not necessary, it might help simplify some things. 虽然这不是必需的,但它可能有助于简化某些事情。

As for myself, I started learning OpenTK with prior experience in XNA, so I already knew the main logic behind games, and the switch to OpenTK was so simple that I found all the information I needed on-line! 至于我自己,我开始学习OpenTK以前在XNA的经验,所以我已经知道游戏背后的主要逻辑,切换到OpenTK非常简单,我找到了我需要的所有在线信息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM