Graphics Reference
In-Depth Information
// attribute variables:
#define aColor gl_Color
#define aNormal gl_Normal
#define aVertex gl_Vertex
#define aTexCoord0 gl_MultiTexCoord0
#define aTexCoord1 gl_MultiTexCoord1
#define aTexCoord2 gl_MultiTexCoord2
#define aTexCoord3 gl_MultiTexCoord3
#define aTexCoord4 gl_MultiTexCoord4
#define aTexCoord5 gl_MultiTexCoord5
#define aTexCoord6 gl_MultiTexCoord6
#define aTexCoord7 gl_MultiTexCoord7
#endif // #ifndef GSTAP_H
These #defines allow you to
use new names for things, without
having to (yet) define them and pass
them in yourself. Then, when the
time comes to complete your migra-
tion to the new approach, you don't
need to make massive code changes
to your shaders. Note that these
names use our variable naming stan-
dard descsribed earlier in this chap-
ter.
To make life even easier for you, the
gstap.h code has been built-in to the glman
software, so that every shader source that
you load automatically has it included.
Just include a line in your .glib file with the
word gstap.h on it. If you use glman , there is
no reason not to transition away from the
deprecated built-in variables right away.
Exercises
The code for all the shaders discussed in this chapter is available on the topic's
website, and this chapter's exercises are mostly concerned with experiments
on this code using the glman application. Details on glman are discussed in the
next chapter, so you may want to use it as a reference while you work on these
exercises.
1. Experiment with shape: in this chapter we only used spheres for our
examples, but glman allows you to use a number of other kinds of shapes.
In the GLIB file for any of these examples, replace the sphere by other
Search WWH ::




Custom Search