如何在C ++中使用XCode 4.2设置OpenGL项目? [英] How do I set up an OpenGL project using XCode 4.2 in C++?

查看:111
本文介绍了如何在C ++中使用XCode 4.2设置OpenGL项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解C ++中的一些图形.我认为最好从功能最强大的图形框架开始,因此我将使用Lion中包含的OpenGL.

I am trying to get in to some graphics in C++. I figured it was best to start with the most capable graphics framework so I am going with the OpenGL included in Lion.

基本上,我在XCode 4.2中使用C ++启动了命令行工具,这就是我要做的所有事情.

Basically I started a command line tool in C++ in XCode 4.2 and that's all I have done.

我需要以某种方式将OpenGL与XCode链接,以便可以使用它.在Mac平台上进行设置后,希望我可以使用OpenGL for C ++的基本操作指南来进一步了解,因为如果您没有注意到,我还不清楚如何使用它.我所读到的几乎所有内容都是有关OpenGL如何将CPU和GPU以及OpenGL客户端和服务器一起使用的一些背景信息.我也将对任何指导性建议表示赞赏.

I need to somehow link OpenGL with the XCode so I can use it. After I get it set up on my Mac platform, I hope I can use a basic how-to guide for OpenGL for C++ to get further as, if you haven't noticed, I am not entirely clear on how to precede. Pretty much all I have read is some background information on how OpenGL uses the CPU and GPU together with the OpenGL client and server. I would appreciate any guide recommendations as well.

问题是:如何在C ++中将OpenGL与XCode 4.2链接在一起(不是Objective-c,这很时髦),以便可以使用图形功能?

The question is: how do I link OpenGL with XCode 4.2 in C++ (not objective-c, it's funky) so I can use the graphics capabilities?

推荐答案

要在XCode中使用OpenGL,必须将OpenGL框架添加到项目中.完成后,头文件和库文件将可用于编译器和链接器.

To use OpenGL in XCode you have to add the OpenGL framework to your project. Once that is done the header and library files will be available to the compiler and linker.

此页面包含创建C语言的分步教程使用OpenGL和GLUT的项目.如果从OpenGL开始,那么使用GLUT可能是一个好主意.本教程将告诉您在某个时候创建​​一个main.c文件.相反,如果要使用C ++,则必须创建main.cpp.

This page has a step by step tutorial for creating a C project that uses OpenGL and GLUT. If you are starting with OpenGL, then using GLUT might be a good idea, by the way. The tutorial will tell you to create a main.c file at some point. Instead, you have to create a main.cpp if you want to use C++.

这篇关于如何在C ++中使用XCode 4.2设置OpenGL项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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