What is the easiest way to join more shaders (sources) to a glsl program? Normally when a vertex shader and fragment shader are attached to a program does something like this:
vertex = glCreateShader(GL_VERTEX_SHADER);
fragment = glCreateShader(GL_FRAGMENT_SHADER);
programa = glCreateProgram();
char *vsFuente = LEE_SHADER(rutaVert);
char *fsFuente = LEE_SHADER(rutaFrag);
if(vsFuente == NULL)return GL_FALSE;
if(fsFuente == NULL)return GL_FALSE;
const char *vs = vsFuente;
const char *fs = fsFuente;
glShaderSource(vertex ,1,&vs,NULL);
glShaderSource(fragment,1,&fs,NULL);
delete [] vsFuente;
delete [] fsFuente;
glCompileShader(vertex);
glCompileShader(fragment);
glAttachShader(programa,vertex);
glAttachShader(programa,fragment);
glLinkProgram(programa);
Well, if I want to join another pair of shader (vertex and fragment) to the same program, how do I do it? I use version 2.0 of OpenGL
glUseProgram (...)
call. – Andon M. Coleman