Chapter 2. The Simplest Programs
This chapter introduces Cg programming through a series of simple vertex and fragment programs. The chapter has the following four sections:
“A Simple Vertex Program” presents a straightforward vertex program and explains the basic elements and syntax of the Cg language.
“Compiling Your Example” explains how to compile programs for different GPUs, using the concept of profiles.
“A Simple Fragment Program” defines a basic fragment program and introduces fragment profiles.
“Rendering with Your Vertex and Fragment Program Examples” shows how to render simple geometry with OpenGL or Direct3D. This section also mentions the concept of clipping.
A Simple Vertex Program
Green is the color associated with inexperience and growth, ...
Get The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.