Skip navigation

Cleaning up the code: Make a texture struct

Cleaning up the code: Make a texture struct: Up and Running with OpenGL
Cleaning up the code: Make a texture struct: Up and Running with OpenGL

Join for an in-depth discussion in this video Cleaning up the code: Make a texture struct, part of Up and Running with OpenGL.

Resume Transcript Auto-Scroll
Skill Level Intermediate
1h 45m
Duration
148,442
Views
Show More Show Less

Q: Why am I getting errors saying I don’t have GLEW installed when I try to create the Xcode projects with Cmake?

<div id="pastingspan1">A: Newer macs running OS X 10.9 Mavericks or later do not come with GLEW preinstalled. You may have it if you upgraded to Mavericks from a previous version of OS X, but it will not be on a new computer or a clean install of the operating system. As such, you&#8217;ll need to install a few things to get GLEW set up.</div><p class="Body"><strong>1) Download, Install, and Run Xcode</strong></p><div id="pastingspan1"><span class="Apple-tab-span"> </span>First, you&#8217;ll need to make sure Xcode is installed and fully loaded. You can download Xcode for free from the Mac App Store. Make sure you open Xcode at least once before proceeding, as it needs to authenticate your administrative privileges before it finishes installing all its components. If you fail to do this, you&#8217;ll receive errors in later steps.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1"><strong>2) Install Homebrew, to Help Install GLEW and CMake</strong></div><div>&nbsp;</div><div id="pastingspan1"><span class="Apple-tab-span"> </span>Next, we&#8217;re going to install Homebrew, which will allow us to install GLEW and also CMake.</div><div>&nbsp;</div><div id="pastingspan1"> </div><div id="pastingspan1">To find out if you have Homebrew installed, open the OS X Terminal and type:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>which</em> <em>brew</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">If brew is installed, Terminal should return &#8220;/usr/local/bin/&#8221;. If it&#8217;s not found, then we&#8217;ll need to install it. To install brew, enter this command in terminal:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">Homebrew will install, and once it&#8217;s completed, you&#8217;ll see it prompt you to run brew doctor, which will test for any issues. To run brew doctor, simply type:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>brew doctor</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">Once it has finished running you&#8217;ll see a list of potential warnings. It&#8217;s important to note that brew is very cautious, so you&#8217;ll likely get at least one or two warnings, but they may not be deal breakers or even cause any problems. Brew is designed to work in a wide variety of applications, most of which we will not be using.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1"><strong>3)<span class="Apple-tab-span"> </span>Install GLEW</strong></div><div>&nbsp;</div><div id="pastingspan1"><span class="Apple-tab-span"> </span>Now that we have brew setup, we&#8217;re going to install GLEW. To install GLEW, type:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>brew install glew</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">Homebrew may recommend you run brew doctor before installing anything, and you should do so if you haven&#8217;t already. See step 2 for more information on brew doctor. At this point you can return to the video if you wish. The rest of the steps are also listed here for reference.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1"><strong>4)<span class="Apple-tab-span"> </span>Install CMake to Build Project Files</strong></div><div>&nbsp;</div><div id="pastingspan1"><span class="Apple-tab-span"> </span>CMake will allow us to build Xcode projects that work with GLEW. There are two ways to install CMake. To see if you have CMake installed, type:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>which cmake</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">Terminal should return &#8220;/usr/local/bin/cmake/&#8221;.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1">If it doesn&#8217;t, you can download and unzip the UNIX/Linux source, a tar.gz file (filename cmake-3.0.0.tar.gz as of publish date) from http://www.cmake.org/cmake/resources/software.html.</div><div>&nbsp;</div><div id="pastingspan1"><strong>(Note: Do not download the binary distribution, as this makes it more difficult to access CMake from the command line.)</strong></div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1">First, in Terminal navigate to your CMake folder, which you can do by typing &#8220;cd &#8221; and then dragging the folder into Terminal. Next type:</div><div id="pastingspan1"><span class="Apple-tab-span"> </span> </div><div id="pastingspan1"><span class="Apple-tab-span"> </span></div><div>&nbsp;</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><em>./bootstrap &amp;&amp; make &amp;&amp; make install</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">CMake should install, and you should be ready to go! If this doesn&#8217;t work, you can also try using brew, though compiling from source is the preferred method. To use brew, from Terminal type:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>brew install cmake</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1"></div><div id="pastingspan1">Brew should install CMake and you&#8217;ll be ready for the next step.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1"><strong>5) Build Xcode Project Files</strong></div><div>&nbsp;</div><div id="pastingspan1">Finally, once GLEW and CMake has finished installing, we need to build our Xcode project to test. (In the following commands where it says &#8220;Exercise Files&#8221;, this should be the location of the Exercise Files you downloaded from lynda.com)</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>cd Exercise Files</em></div><div id="pastingspan1"><em>mkdir xcode</em></div><div id="pastingspan1"><em>cd xcode</em></div><div id="pastingspan1"><em>cmake -G "Xcode" ..</em></div><div>&nbsp;</div></blockquote><div id="pastingspan1"></div><div id="pastingspan1">Once completed, there should be a project available in the &#8220;xcode&#8221; folder that was created.</div><div>&nbsp;</div><div id="pastingspan1"></div><div id="pastingspan1">If you prefer, you can also build individual projects for each C++ file at a time by running a command like this:</div><div>&nbsp;</div><div id="pastingspan1"></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div id="pastingspan1"><em>./run.sh examples/Extensions.cpp</em></div></blockquote><div></div>

Skills covered in this course
Developer Games OpenGL

Continue Assessment

You started this assessment previously and didn't complete it. You can pick up where you left off, or start over.

Start Your Free Trial Now

Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now