Does freetype comes pre-installed on Mac?

前端 未结 1 509
别那么骄傲
别那么骄傲 2021-01-18 01:22

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-

相关标签:
1条回答
  • 2021-01-18 01:57

    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 :)

    0 讨论(0)
提交回复
热议问题