March 2013
Intermediate to advanced
984 pages
26h 18m
English
Let’s take a closer look at specifying color data with a vertex. Recall from Chapter 1 that vertices can have multiple data values associated with them, and colors can be among them. As with any other vertex data, the color data must be stored in a vertex-buffer object. In Example 4.1, we interleave the vertices’ color and position data, and use an integer-valued type to illustrate having OpenGL normalize our values.
Example 4.1. Specifying Vertex Color and Position Data: gouraud.cpp
/////////////////////////////////////////////////////////////////////////// Gouraud.cpp/////////////////////////////////////////////////////////////////////////#include <iostream>using namespace std;#include "vgl.h"#include ...