In history, graphics hardware is developed from very low-level. The pipelines of the fixed feature are set by setting state, such as texture-combining mode. More than some, the programmer can set the programmable line by using the programming interface of the assembly language layer. In theory, these low-level programming languages provide great flexibility. In practical applications, they are very painful and have a great obstacle to effectively use hardware.
Use advanced programming languages, rather than using previous low-level programming languages:
When the shader is developed, the advanced language can accelerate the run cycle. The final test of the shader becomes "it looks right?". At the end, the rapid prototype and the rapid development of the shadder becomes critical in the rapid development of high quality effects. The compiler can automatically optimize the code and perform low-level tasks, such as registration address assignments, which is easily error-free and tedious. Coloring code is more susceptible to read and understand with advanced language. This also allows for easy creation of new shaders by modifying the previously written shaders. What is the best way to learn what they have written from the best artists and programmers? The shaders written in advanced languages are more suitable for extensive platforms than using assembly code.
This chapter describes the CG (C for Graphics) to program specially designed for GPU. CG provides all the advantages just mentioned, which ultimately makes programmers to easily program the GPU programming and play a powerful power of GPUs.
CG language
CG is based on C, but enhances and adjusts it to easily program and compile becomes a highly optimized GPU code. The CG code looks very similar to the CG code, using the same declaration syntax, function call, and most data types.
Explaining some of the differences between CG languages and C in detail to the CG language. Basically, it is due to the difference between the GPU and CPU programming mode.