openGL API glShaderSource详解
来源:http://www.tudoupe.com时间:2021-12-17
OpenGL API 中的 gl shader 源头
- 官方文档
- 翻译
- 例子
- 运行效果
- 工程下载
官方文档
glShaderSource — Replaces the source code in a shader object
C Specification
void glShaderSource( GLuint shader,
GLsizei count,
const GLchar **string,
const GLint *length);
Parameters
shader
Specifies the handle of the shader object whose source code is to be replaced.
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.
Description
glShaderSource sets the source code in shader to the source code in the array of strings specified by string. Any source code previously stored in the shader object is completely replaced. The number of strings in the array is specified by count. If length is NULL, each string is assumed to be null terminated. If length is a value other than NULL, it points to an array containing a string length for each of the corresponding elements of string. Each element in the length array may contain the length of the corresponding string (the null character is not counted as part of the string length) or a value less than 0 to indicate that the string is null terminated. The source code strings are not scanned or parsed at this time; they are simply copied into the specified shader object.
Notes
OpenGL copies the shader source code strings when glShaderSource is called, so an application may free its copy of the source code strings immediately after the function returns.
Errors
GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.
GL_INVALID_OPERATION is generated if shader is not a shader object.
GL_INVALID_VALUE is generated if count is less than 0.
Associated Gets
glGetShader with arguments shader and GL_SHADER_SOURCE_LENGTH
glGetShaderSource with argument shader
glIsShader
Version Support
OpenGL Version
Function / Feature Name 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5
glShaderSource ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔
See Also
glCompileShader, glCreateShader, glDeleteShader
Copyright
Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
翻译
名称
glShader 源代码 - 替换颜色对象源代码 。
C规范
void glShaderSource(GLuint shader,GLsizei count,const GLchar * const *string,const GLint *length);
参数
shader
count
string
length
描述
帮助开发彩色编译器,glShader 源代码将颜色源代码更改为字符串提供的字符串数组中的源代码 。颜色对象中所有先前保存的源代码将被全部替换 。计数用于指定数组中字符串的长度 。如果省略长度,考虑到每条字符串以无字符串结束。如果长度不等于 NULL,它指含有字符串的每个相应元素的字符串长度矩阵。长度数组中的每个成员可以包含相关字符串的长度( 无效字符不被视为字符串长度的一部分), 或者小于 0 的数以表示字符串的结尾为空 。在这一点上,源代码文本未经检查或分析;只是转移到选定的颜色对象。
注意
色彩编纂器的支持是可选的 。因此,在给GlGet打电话之前,必须发送 GL_SHADER_COMPILER 选项。glShaderSource,glCompileShader,glGetShaderPrecisionFormat,gl 释放元件合成器和其他软件将返回 GL_INVALID_OPERATION, 如果不支持彩色编译器的安装 。这是通过提供替代glShaderBinary的替代品来实现的。彩色者用来提供预编辑译文的二进制文件 。
当您使用 glShader 源代码时, OpenGL 重建颜色源字符串, 这样函数返回后您就可以放弃副本 。
错误
GL_INVALID_OPERATION: 没有色彩编纂器支持 。
阴影不是 OpenGL 生成的值, 导致 GL_ INVALID_ VALUE 。
形状不是彩色对象, 导致 GL_ INVALID_ Operation 。
GL_ INVALID_ VALUUE: 计算小于 0
相关Gets
gl 保持 GL_SHADER_ COMPILER 参数 。
阴影 glGetShaderiv 和 GL_Sheader_ SOURCE_ 语言
参数shader glGet shader 源代码
glIsShader
另见
glCompileShader,glGetShaderPrecisionFormat,glCreateShader,glDeleteShader
版权
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glShaderSource.xml
https://blog.csdn.net/flycatdeng
本文是根据SGI自由软件B许可证获得许可的。 更多见http://oss. org.
例子
运行效果
工程下载
工程源码下载
上一篇:小白装机系统是正版吗
相关新闻
- 2023-05-06 微pe怎么初始化U盘(微pe怎么恢复初
- 2023-05-06 Xp系统boot 进入pe(boot manager 怎么进入
- 2023-05-06 win pe修复bcdboot(pe修复系统)
- 2023-05-06 win7更新失败 pe(win7更新失败还原更
- 2023-05-06 u盘装了pe读取不了(u盘能进pe读取不
- 2023-05-06 u盘pe 发热(u盘发热烫手)
- 2023-05-06 u盘pe下看不到硬盘(u盘启动pe看不到
- 2023-05-06 pe盘 ntfs(u盘ntfs格式)
- 2023-05-06 sony笔记本进入pe模式(联想笔记本怎
- 2023-05-06 pe启动盘进不去(pe启动盘进不去系统
|
|
|
|
|
|
|
|
|
|