Does freetype comes pre-installed on Mac?

谁说我不能喝 提交于 2019-12-08 17:35:32

问题


I am relatively new to Mac OS X environment. I was trying to install freetype library to display text in OpenGL, but I failed. I read on some forum that freetype comes pre-installed with Mac OS X mountain lion. I just wanted to confirm this. If it does in fact comes with Mac then how can I include it in my project? If it doesn't comes with Mac then what is the ideal set of step one would follow to install freetype in Mac?


回答1:


The dynamic linking library comes pre-installed, so you can use any software that requires freetype2 out of the box:

/usr/X11/lib/libfreetype.6.dylib

However, the actual headers and such required to build a freetype2 project do not ship with OS X. To get these, you need to install Xcode; when you install Xcode with any version of the OS X platform SDK, it comes with freetype2:

/Developer/SDKs/MacOSX10.6.sdk/usr/X11/include/freetype2/freetype/freetype.h

These days, I think you have to go through the App Store in order to download Xcode, but it is free and that is about all you need to get started developing GL / freetype2 software on OS X. I believe they stopped including Xcode on the OS X install DVDs with the release of 10.6, so registering as an Apple Developer or going through the App Store is probably your only option.


By the way, you are going to have to jump through some hoops when you start using OpenGL on OS X for the first time. It is a little different from most platforms, particularly when it comes to loading (or rather not loading) extensions at run-time. Apple implements the full feature set for OpenGL 2.1 / 3.2 core for all OS X 10.7+ systems even if the underlying GPU does not support it all - it has software fallbacks for anything not supported by hardware.

So you don't have to worry about loading extensions based on the installed GPU capabilities, but you do have to worry about whether using a feature will throw you onto a software path. You also have to put up with longer than average wait time for new versions of OpenGL to be implemented, but this is the price you pay for guaranteed feature set support I suppose.

I would suggest you use something like glfw or SDL2 when starting out, especially if you don't like Objective C (does anyone, honestly?). A lot of newer OpenGL context management these days needs to be done using Objective C (cocoa); Apple is not a big fan of their own C APIs (carbon). glfw and SDL2 hide all this stuff from you so you never have to write a single piece of ugly Objective C code if you do not want :)



来源:https://stackoverflow.com/questions/18887445/does-freetype-comes-pre-installed-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!