March 2013
Intermediate to advanced
984 pages
26h 18m
English
A shader program, just like a “C” program, starts execution in main(). Every GLSL shader program begins life as follows:
#version 330 corevoid main(){ // Your code goes here}
The // construct is a comment and terminates at the end of the current line, just like in “C”. Additionally, “C”-type, multiline comments—the /* and */ type—are also supported. However, unlike ANSI “C”, main() does not return an integer value; it is declared void. Also, as with “C” and its derivative languages, statements are terminated with a semicolon. While this is a perfectly legal GLSL program that compiles and even runs, its functionality leaves something to be desired. To add a little more excitement to our shaders, ...
Read now
Unlock full access