想学习如何在Objective-C中使用OpenGL,但不知道从哪里开始。帮帮我? [英] Would like to learn how to use OpenGL within Objective-C, but have no idea where to start. Help?

查看:269
本文介绍了想学习如何在Objective-C中使用OpenGL,但不知道从哪里开始。帮帮我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对OpenGL没有经验,对Objective-C有少量的经验,但是用C ++我相当不错。我应该看看什么资源开始学习如何在Objective-C中使用OpenGL?

I have zero experience with OpenGL and a small amount of experience with Objective-C, but I'm fairly decent with C++. What resources should I be looking at to start learning how to use OpenGL within Objective-C?

我在某处阅读某个地方,从NSOpenGLView开始是一个好的开始。

I read somewhere at some point that starting out with NSOpenGLView is a good start.

推荐答案

老实说,你可能不需要知道多少Objective-C处理OpenGL,只是C. OpenGL是基于C的,所以你不需要学习任何新的,语言方面的,来处理它。 Objective-C知识只有当你计划使用Cocoa来构建你的界面时才真正需要。即使这样,如果你来自一个坚实的C / C ++背景,这门语言也不难理解。

Honestly, you're probably not going to need to know much Objective-C for dealing with OpenGL, just C. OpenGL is C-based, so you don't need to learn anything new, language-wise, to deal with it. Objective-C knowledge is only really necessary when you plan on using Cocoa to build up your interface. Even then, the language is not hard to pick up if you're coming from a solid C / C++ background.

我强烈推荐这本书 iPhone 3D编程,Matt的第一个资源是基于。即使你问的是桌面OpenGL,这本书涵盖了OpenGL ES,很多是在两个API之间共享的。这本书从简单的概念和基础开始,然后构建到更高级的主题,如环境映射和自定义着色器。作者使用C ++作为本书的基本语言,所以你应该熟悉甚至他所展示的最复杂的代码。

I highly recommend the book iPhone 3D Programming that Matt's first resource is based on. Even though you're asking about desktop OpenGL, and this book covers OpenGL ES, much is shared between the two APIs. The book does a great job of starting with simple concepts and fundamentals, and then building to more advanced topics like environment mapping and custom shaders. The author uses C++ as his base language for the book, so you should be familiar with even the most complex code he shows. OpenGL ES is effectively a subset of OpenGL, so almost everything translates across to the desktop.

在桌面Cocoa应用程序中,你有两种方式提供OpenGL内容:NSOpenGLView和CAOpenGLLayer。前者是一个较旧的NSView子类,您可以自定义将渲染代码放在其中。后者是一个核心动画CALayer,也充当一个OpenGL渲染目标,但它给你一个更多的灵活性,如何可以覆盖OpenGL内容的其他项目。为您的OpenGL渲染设置显示不会花费很多精力,大部分时间花在您的OpenGL代码上。

Within a desktop Cocoa application, you have two ways of presenting OpenGL content: NSOpenGLView and CAOpenGLLayer. The former is an older NSView subclass that you can customize to place your rendering code within. The latter is a Core Animation CALayer that also acts as an OpenGL rendering target, but it give you a little more flexibility in how you can overlay other items on top of the OpenGL content. Getting the display set up for your OpenGL rendering will not take a lot of effort, with most of your time being spent on your OpenGL code.

您可能想分开一些Apple的示例应用程序,例如 GLSL Showpiece Cocoa OpenGL GLEssentials ,以及 CubePuzzle ,其中其他OpenGL示例他们在开发人员中心。

You might want to pick apart some of Apple's sample applications, such as GLSL Showpiece, Cocoa OpenGL, GLEssentials, and CubePuzzle, among the other OpenGL examples they have in the developer center.

这篇关于想学习如何在Objective-C中使用OpenGL,但不知道从哪里开始。帮帮我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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