替换着色器中的代码,任何以前的代码都会被完全替换掉,一次可以上传多段代码进行替换,并不进行代码的扫描和解析
替换完后是否需要重新进行编译和链接呢?????(因为着色器代码需要编译、连接,最后生成可执行文件才能被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* sourceTe

glShaderSource函数用于替换OpenGL着色器对象的源代码,旧代码会被完全替换,新代码需要重新编译和链接以生成可执行文件。参数包括着色器ID、字符串数量、源代码指针数组和字符串长度数组。如果长度数组为空,假设每个字符串都有结束符。
最低0.47元/天 解锁文章
758

被折叠的 条评论
为什么被折叠?



