第一步
创建工程

第二步
在TARGETS -> Build Phases -> Link Binary With Libraries 中添加 GLUT.framework 和 OpenGL.framework

第三步
将 include 拉进工程;libGLTools.a 拉进Frameworks中(文件可在文章结尾的Demo中获取)

第四步
在TARGETS -> Build Settings -> Header Search Paths 中添加include(option + 拖拽include至Header Search Paths中)

在TARGETS -> Build Phases -> Link Binary With Libraries中如果没有libGLTools.a则手动添加。
第五步
Delete AppDelegate.h、AppDelegate.m、ViewController.h、ViewController.m、main.m五个文件,新建C++ file,命名main,取消勾选"Also create a header file"。
第六步
将demo中main.cpp的内容复制运行(或者自己找测试代码)。
效果图:

补充:OpenGL Demo
网友评论