{"id":192,"date":"2016-01-10T11:50:54","date_gmt":"2016-01-10T03:50:54","guid":{"rendered":"http:\/\/www.yarpee.com\/?p=192"},"modified":"2016-01-10T11:52:33","modified_gmt":"2016-01-10T03:52:33","slug":"mac-opengl%e8%b8%a9%e5%9d%91%e8%ae%b0","status":"publish","type":"post","link":"http:\/\/www.yarpee.cn\/?p=192","title":{"rendered":"Mac OpenGL\u8e29\u5751\u8bb0"},"content":{"rendered":"<p>\u5728Mac\u4e0a\u5c1d\u8bd5\u5199OpenGL\u7a0b\u5e8f\uff0c\u7ed3\u679c\u8e29\u4e86\u4e00\u5806\u5751\uff0c\u5728\u6b64\u8bb0\u5f55\u4e0b\u6765\uff0c\u4ee5\u5907\u540e\u7528\u3002<\/p>\n<p>Mac\u4e0a\u5df2\u7ecf\u5e26\u4e86GLUT\uff0c\u4f7f\u7528\u65f6\u53ea\u9700#include &lt;GLUT\/GLUT.h&gt;\u5373\u53ef\u3002\u4f46\u4f7f\u7528GLUT\u51fd\u6570\u7f16\u8bd1\u65f6\uff0cXcode\u4f1a\u8b66\u544a\u76f8\u5173\u51fd\u6570\u5df2\u7ecf\u5728OS X 10.9\u4e2d\u5e9f\u5f03\uff1a<\/p>\n<p>&#8216;glutInit&#8217; is deprecated: first deprecated in OS X 10.9<\/p>\n<p>\u6d88\u9664\u8be5\u8b66\u544a\u7684\u65b9\u6cd5\u662f\u5728Build Settings\u4e2d\u5c06OS X Deployment Target\u6539\u4e3aOS X 10.8\uff0c\u4f46\u8fd9\u663e\u7136\u4e0d\u662fApple\u8ba4\u53ef\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u66f4\u597d\u7684\u65b9\u6848\u662f\u4f7f\u7528GLFW\u548cGLEW\u66ff\u4ee3GLUT\u3002<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/24095931\/glut-deprecation-in-mac-osx-10-9-ide-qt-creator\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/24095931\/glut-deprecation-in-mac-osx-10-9-ide-qt-creator<\/a><\/p>\n<p>\u4f7f\u7528GLFW\u548cGLEW\u7684\u95ee\u9898\u662fOS X\u9ed8\u8ba4\u5e76\u6ca1\u6709\u5e26\u4e0a\u8fd9\u4e24\u4e2a\u5e93\uff0c\u9700\u8981\u6211\u4eec\u81ea\u5df1\u5b89\u88c5\u3002<\/p>\n<p>\u4eceGLFW\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u6e90\u7801\uff0c\u4f7f\u7528CMake\u7f16\u8bd1\uff1a<\/p>\n<p><a href=\"http:\/\/www.glfw.org\/docs\/latest\/compile.html#compile_compile\" target=\"_blank\">http:\/\/www.glfw.org\/docs\/latest\/compile.html#compile_compile<\/a><\/p>\n<p>\u7f16\u8bd1\u51fa\u7684\u9759\u6001\u5e93\u8def\u5f84\u5728\u7528CMake\u65b0\u5efa\u7684\u5de5\u7a0b\u6587\u4ef6\u5939\u4e0b\uff1a<\/p>\n<p>glfw-3.1.2\/src\/Debug\/libglfw3.a<\/p>\n<p>#include\u5934\u6587\u4ef6\u8def\u5f84\u5728\u6e90\u7801\u6587\u4ef6\u5939\u4e0b\uff1a<\/p>\n<p>glfw-3.1.2\/include\/GLFW\/glfw3.h<\/p>\n<p>\u5728Build Settings\u4e2d\u8bbe\u7f6e\u597dHeader Search Paths\u548cLibrary Search Paths\uff0c\u5728Build Phases\u7684Link Binary With Libraries\u5c06libglfw2.a\u8bbe\u7f6e\u597d\uff0c\u6b64\u65f6\u7f16\u8bd1Xcode\u4f1a\u62a5\u5f88\u591aUndefined symbols\u7684\u9519\u8bef\uff1a<\/p>\n<p>Undefined symbols for architecture x86_64:<\/p>\n<p>&#8220;_CFArrayAppendValue&#8221;, referenced from:<\/p>\n<p>__glfwInitJoysticks in libglfw3.a(iokit_joystick.o)<\/p>\n<p>_addJoystickElement in libglfw3.a(iokit_joystick.o)<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3alibglfw3.a\u5728Mac OS X\u4e0a\u4f7f\u7528\u4e86Cocoa\uff0c\u4f9d\u8d56\u4e86\u51e0\u4e2a\u5176\u5b83\u7684\u5e93\uff1aCocoa\u3001IOKit\u548cCoreVideo\u3002\u5c06\u8fd93\u4e2a\u5e93\u4e5f\u5728Link Binary With Libraries\u4e2d\u8bbe\u7f6e\u597d\uff0c\u7f16\u8bd1\u5c31\u80fd\u901a\u8fc7\u4e86\u3002<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/18391487\/compiling-with-glfw3-linker-errors-undefined-reference\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/18391487\/compiling-with-glfw3-linker-errors-undefined-reference<\/a><\/p>\n<p>\u4f7f\u7528GLEW\u5148\u4ece\u5b83\u7684\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u6e90\u7801\uff0c\u7136\u540e\u4f9d\u6b21\u4f7f\u75283\u4e2amake\u547d\u4ee4\u7f16\u8bd1\u5b89\u88c5\uff1a<\/p>\n<p>1\u3001make\uff0c\u7f16\u8bd1\u3002<\/p>\n<p>2\u3001sudo make install\uff0c\u5b89\u88c5\uff0c\u5c06\u5934\u6587\u4ef6\u548c\u5e93\u6587\u4ef6\u62f7\u8d1d\u5230\u7cfb\u7edf\u5934\u6587\u4ef6\u548c\u5e93\u6587\u4ef6\u5b58\u653e\u76ee\u5f55\u3002<\/p>\n<p>3\u3001make clean\uff0c\u6e05\u9664\u7f16\u8bd1\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u7559\u4e0b\u6765\u7684\u5783\u573e\u6587\u4ef6\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/nigels-com\/glew\" target=\"_blank\">https:\/\/github.com\/nigels-com\/glew<\/a><\/p>\n<p>\u5728Mac OS X EI Capitan\u4e0asudo make install\u65f6\u9047\u5230\u4e86\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n<p>install -d -m 0755 &#8220;\/usr\/include\/GL&#8221;<\/p>\n<p>install: mkdir \/usr\/include: Operation not permitted<\/p>\n<p>make: *** [install.include] Error 71<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a\u4eceEI Capitan\u5f00\u59cb\uff0cMac OS X\u542f\u7528\u4e86System Integrity Protection\uff0c\u4e0d\u518d\u5141\u8bb8\u76f4\u63a5\u64cd\u4f5c\/usr\u4e0b\u7684\u76ee\u5f55\uff0c\u4f46\/usr\/local\u9664\u5916\uff0c\u6240\u4ee5\u9700\u8981\u5c06GLEW\u5b89\u88c5\u5728\/usr\/local\u4e0b\u3002\u8fd9\u91cc\u53ea\u9700\u8981\u4fee\u6539GLEW\u7684Makefile\u5373\u53ef\uff0c\u5c06GLEW_DEST ?= \/usr\u4fee\u6539\u4e3aGLEW_DEST ?= \/usr\/local\uff0c\u518d\u6267\u884csudo make install\u3002<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/33309005\/sudo-mkdir-in-usr-operation-not-permitted-el-capitan\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/33309005\/sudo-mkdir-in-usr-operation-not-permitted-el-capitan<\/a><\/p>\n<p>\u540c\u6837\u9700\u8981\u914d\u7f6e\u597dHeader Search Paths\u3001Library Search Paths\u548cLink Binary With Libraries\u3002\u6b64\u65f6\u7f16\u8bd1\u62a5\u9519\uff1a<\/p>\n<p>\/usr\/local\/include\/GL\/glew.h:16426:17: Declaration of &#8216;PFNGLCOPYTEXSUBIMAGE3DPROC&#8217; must be imported from module &#8216;OpenGL.GL3&#8217; before it is required<\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u5c06Build Settings\u91cc\u7684Enable Modules(C and Objective-C)\u8bbe\u4e3aNo\u5373\u53ef\u3002\u6700\u540e\u522b\u5fd8\u4e86Link OpenGL\u5e93\u672c\u8eab\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Mac\u4e0a\u5c1d\u8bd5\u5199OpenGL\u7a0b\u5e8f\uff0c\u7ed3\u679c\u8e29\u4e86\u4e00\u5806\u5751\uff0c\u5728\u6b64\u8bb0\u5f55\u4e0b\u6765\uff0c\u4ee5\u5907\u540e\u7528\u3002 Mac\u4e0a\u5df2\u7ecf\u5e26\u4e86GLUT\uff0c\u4f7f\u7528\u65f6\u53ea &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.yarpee.cn\/?p=192\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cMac OpenGL\u8e29\u5751\u8bb0\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-192","post","type-post","status-publish","format-standard","hentry","category-mac_skill"],"_links":{"self":[{"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/posts\/192"}],"collection":[{"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=192"}],"version-history":[{"count":3,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/posts\/192\/revisions"}],"predecessor-version":[{"id":195,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=\/wp\/v2\/posts\/192\/revisions\/195"}],"wp:attachment":[{"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.yarpee.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}