I\'d like to declare GLSL shader strings inline using macro stringification:
#define STRINGIFY(A) #A
const GLchar* vert = STRINGIFY(
#version 120\\n
attribu
Unfortunately, having preprocessor directives in the argument of a macro is undefined, so you can't do this directly. But as long as none of your shaders need preprocessor directives other than #version, you could do something like:
#define GLSL(version, shader) "#version " #version "\n" #shader
const GLchar* vert = GLSL(120,
attribute vec2 position;
void main()
{
gl_Position = vec4( position, 0.0, 1.0 );
}
);