立方体的 IOS GLKit 纹理

发布于 2025-01-06 06:11:13 字数 224 浏览 3 评论 0原文

IOS OpenGL 编程新手。我已经完成了一些讨论 OpenGL ES 基础知识的教程,并能够创建一个小型演示程序,在场景中我想要的位置绘制立方体。我想将纹理应用到立方体的表面,但由于某种原因,这似乎是一项几乎不可能完成的任务。我正在使用 GLKit ,我已经搜索遍了,但找不到一个关于如何在没有很多其他内容的情况下执行此操作的非常简单的教程。谁能指出我正确的方向或有这方面的教程吗?看起来这应该不是一件难事。我一定是错过了什么..

new to IOS OpenGL programming. I have worked through a few tutorials that talk about the basics of OpenGL ES and been able to create a small demo program that draws cubes in a scene at positions I want. Id like to apply a texture to the faces of the cube but for some reason this seems to be a near impossible task to figure out. Im using GLKit , Ive searched all over and can't find a dead simple tutorial on how to do this without a lot of other fluff. Can anyone point me in the correct direction or have a tutorial on this? It doesn't seem like this should be hard thing to do. I must be missing something..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸伞微斜 2025-01-13 06:11:13

转到此处获取有关此问题的许多教程 http://www.raywenderlich.com/

或此处

http://www.raywenderlich.com/5223/beginning-opengl- es-2-0-with-glkit-part-1

这个详细解释了纹理:

http://db-in.com/blog/2011 /02/all-about-opengl-es-2-x-part-23/

我建议不要直接使用 glkit (也许是一些辅助方法),因为即使如此它也更容易,因为它的工作方式大部分与 opengl 1 类似这gl es 2.0 的教程不会使用它,你会感到困惑。

使用这个让 glkit 加载纹理

https://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010922

尝试使用像 glkit 纹理示例这样的谷歌,

这就是我得到的:

https://github.com/jlamarche/iOS-OpenGLES-Stuff/blob/master/GLKit%20Stuff/GLKBaseEffect%20Drawing%20Example%20with%20Texture/blah/MCViewController.m

在第 119 行左右,您可以看到如何使用纹理,我还没有检查过,但它似乎有效。我通常更喜欢只使用普通的 opengl,因为即使你有一个简单的程序,着色器文件也非常简单(比如少于 10 行)。

Go here for many tutorials bout this http://www.raywenderlich.com/

or here

http://www.raywenderlich.com/5223/beginning-opengl-es-2-0-with-glkit-part-1

this one explains about textures in detail:

http://db-in.com/blog/2011/02/all-about-opengl-es-2-x-part-23/

Id recomend not to use glkit directly (maybe some helper methods) since even tho it is easier as it works like opengl 1 most of the tutorials for gl es 2.0 wont use it and you will get confused.

Use this one for glkit to load textures

https://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010922

Try google with something like glkit texture example

this is what i got :

https://github.com/jlamarche/iOS-OpenGLES-Stuff/blob/master/GLKit%20Stuff/GLKBaseEffect%20Drawing%20Example%20with%20Texture/blah/MCViewController.m

around line 119 you can see how to use the texture, i havent checked it but it seems valid. I usually prefer to just use normal opengl since even when you have a simple program the shader file is ridiculously simple, (like less than 10 lines).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文