Drawing geometric primitives

-In this lesson we're going to take a look…at a quick and easy way to get some content…into the window that we've created.…We're going to do this with something called…immediate mode, or the fixed function pipeline.…This is Legacy old-school OpenGL,…and it's actually been deprecated as a version three,…so we're not going to talk about it too much;…however, I do find it's useful for de-bugging…purposes, and it's really useful for you…to be able to recognize it when you see it.…So, let's get started.…

On line 27 we call a draw function.…In the draw function, we have four new GL…commands I'd like to introduce you to.…The first is GL begin.…GL begin takes as an argument a type…of GL primitive.…This could be triangles, lines, points.…We'll talk about the different options in a little bit.…GL color three f takes three floating point values,…one for the red, one for the green,…and one for the blue.…In this case on line 30 we're specifying…the color red.…

GL vertex three f takes three floating point values…that specify a coordinate, one for the x,…

Resume Transcript Auto-Scroll

Author

Released

8/5/2014

Ready to take your graphics to the next level? Get up and running with OpenGL, the cross-language, multiplatform API for rendering 2D and 3D computer graphics. OpenGL is widely used in CAD, virtual reality, scientific visualization, and video games, where it is particularly useful for game developers who benefit from its hardware-accelerated rendering and advanced programmable pipeline. In this course, Pablo Colapinto will show you how to render real-time content, starting with building a window for your graphics with the GFLW library. Then he'll focus on drawing in 2D and 3D with both the legacy immediate mode and the more modern method of using buffer objects. Plus, learn about texturing and lighting with the GLSL shading language, and accepting keyboard and mouse input for increased interactivity. Start accelerating your graphics with OpenGL today.

Topics include:

What is OpenGL?

Setting up an OpenGL workflow

Creating a window with GLFW

Working with geometric primitives

Rotating, translating, and scaling

Understanding matrix transformations

Creating mesh data structures

Buffering mesh data

Getting mouse and keyboard input

Skill Level Intermediate

1h 45m

Duration

194,048

Views

Show MoreShow Less

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

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’ll need to install a few things to get GLEW set up.

1) Download, Install, and Run Xcode

First, you’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’ll receive errors in later steps.

2) Install Homebrew, to Help Install GLEW and CMake

Next, we’re going to install Homebrew, which will allow us to install GLEW and also CMake.

To find out if you have Homebrew installed, open the OS X Terminal and type:

whichbrew

If brew is installed, Terminal should return “/usr/local/bin/”. If it’s not found, then we’ll need to install it. To install brew, enter this command in terminal:

Homebrew will install, and once it’s completed, you’ll see it prompt you to run brew doctor, which will test for any issues. To run brew doctor, simply type:

brew doctor

Once it has finished running you’ll see a list of potential warnings. It’s important to note that brew is very cautious, so you’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.

3)Install GLEW

Now that we have brew setup, we’re going to install GLEW. To install GLEW, type:

brew install glew

Homebrew may recommend you run brew doctor before installing anything, and you should do so if you haven’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.

4)Install CMake to Build Project Files

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:

which cmake

Terminal should return “/usr/local/bin/cmake/”.

If it doesn’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.

(Note: Do not download the binary distribution, as this makes it more difficult to access CMake from the command line.)

First, in Terminal navigate to your CMake folder, which you can do by typing “cd ” and then dragging the folder into Terminal. Next type:

./bootstrap && make && make install

CMake should install, and you should be ready to go! If this doesn’t work, you can also try using brew, though compiling from source is the preferred method. To use brew, from Terminal type:

brew install cmake

Brew should install CMake and you’ll be ready for the next step.

5) Build Xcode Project Files

Finally, once GLEW and CMake has finished installing, we need to build our Xcode project to test. (In the following commands where it says “Exercise Files”, this should be the location of the Exercise Files you downloaded from lynda.com)

cd Exercise Files

mkdir xcode

cd xcode

cmake -G "Xcode" ..

Once completed, there should be a project available in the “xcode” folder that was created.

If you prefer, you can also build individual projects for each C++ file at a time by running a command like this: