替换着色器中的代码,任何以前的代码都会被完全替换掉,一次可以上传多段代码进行替换,并不进行代码的扫描和解析
替换完后是否需要重新进行编译和链接呢?????(因为着色器代码需要编译、连接,最后生成可执行文件才能被CPU/GPU调度执行,所以替换完后还是需要重新进行编译和链接)
void glShaderSource( GLuint shader,
GLsizei count,
const GLchar **string,
const GLint *length);
shader
Specifies the handle of the shader object whose source code is to be replaced.
指定要被替换源代码的着色器对象的句柄(ID)
count
Specifies the number of elements in the string and length arrays.
指定字符串和长度数组中的元素数
string
Specifies an array of pointers to strings containing the source code to be loaded into the shader.
指定指向包含要加载到着色器的源代码的字符串的指针数组
length
Specifies an array of string lengths.
指定字符串长度的数组,如果为空,则每一个字符串都是有结尾的,将整个字符串进行拷贝替换。
const GLchar* sourceText[3