openframeworks/openFrameworks — pull request #3164 by tgfrerer (2014-08-22 14:29:48+00:00)
Title: Small fixes to ofShader

This PR has a couple of small, but i hope useful fixes to ofShader.

### Add printout for offending shader lines if shader compilation returns an error:

As soon as an ofShader uses the ```#pragma include``` directive, line numbers referred to in error messages were off by whichever number of lines the ```#pragma include``` injected.

By printing out the offending line as it appears within the current shader source ( + a couple of lines of context), errors can be found more reliably.

### Example error log:

[ error ] ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader failed to compile
[ error ] ofShader: GL_FRAGMENT_SHADER shader reports:
ERROR: 0:74: Initializer not allowed

[ error ] ofShader: GL_FRAGMENT_SHADER, offending line 74 :
72	vec3 A = toSurface_ * t;	// calculate position of lightPos projected onto view ray dir = midpoint A
73	vec3 m = lightPos - A;	// now we can calculate the connecting vector from A to lightpos
74	const float dist2 = dot(m,m);	// distance of light to point projected onto view ray, squared
75	const float r2 = r_ * r_ ;	// light radius squared.
76