Code collected from GLWiki.
/* The vertex shader */ char *vsSource = file2string("wave.vert"); char *fsSource = file2string("wave.frag"); /* Compile and load the program */ GLuint vs, /* Vertex Shader */ fs, /* Fragment Shader */ sp; /* Shader Program */ vs = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vs, 1, &vsSource, NULL); glCompileShader(vs); printLog(vs); fs = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fs, 1, &fsSource, NULL); glCompileShader(fs); printLog(fs); free(vsSource); free(fsSource); sp = glCreateProgram(); glAttachShader(sp, vs); glAttachShader(sp, fs); glLinkProgram(sp); printLog(sp); glUseProgram(sp);