GLAPI/glGetShaderSource: Difference between revisions
m Renaming category: 'API Reference 4' to 'Core API Reference'. |
m Bot: Adding better formatting. |
||
(3 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
== Function Definition == | == Function Definition == | ||
void '''glGetShaderSource'''(GLuint | void '''glGetShaderSource'''(GLuint {{param|shader}}, GLsizei {{param|bufSize}}, GLsizei *{{param|length}}, GLchar *{{param|source}}); | ||
; shader | ; shader | ||
Line 15: | Line 15: | ||
: Specifies the size of the character buffer for storing the returned source code string. | : Specifies the size of the character buffer for storing the returned source code string. | ||
; length | ; length | ||
: Returns the length of the string returned in | : Returns the length of the string returned in {{param|source}} (excluding the null terminator). | ||
; source | ; source | ||
: Specifies an array of characters that is used to return the source code string. | : Specifies an array of characters that is used to return the source code string. | ||
Line 21: | Line 21: | ||
== Description == | == Description == | ||
'''glGetShaderSource''' returns the concatenation of the source code strings from the shader object specified by | '''glGetShaderSource''' returns the concatenation of the source code strings from the shader object specified by {{param|shader}}. The source code strings for a shader object are the result of a previous call to {{apifunc|glShaderSource}}. The string returned by the function will be null terminated. | ||
'''glGetShaderSource''' returns in | '''glGetShaderSource''' returns in {{param|source}} as much of the source code string as it can, up to a maximum of {{param|bufSize}} characters. The number of characters actually returned, excluding the null termination character, is specified by {{param|length}}. If the length of the returned string is not required, a value of {{code|NULL}} can be passed in the {{param|length}} argument. The size of the buffer required to store the returned source code string can be obtained by calling {{apifunc|glGetShader}} with the value {{enum|GL_SHADER_SOURCE_LENGTH}}. | ||
== Errors == | == Errors == | ||
{{ | {{enum|GL_INVALID_VALUE}} is generated if {{param|shader}} is not a value generated by OpenGL. | ||
{{ | {{enum|GL_INVALID_OPERATION}} is generated if {{param|shader}} is not a shader object. | ||
{{ | {{enum|GL_INVALID_VALUE}} is generated if {{param|bufSize}} is less than 0. | ||
== Associated Gets == | == Associated Gets == | ||
{{apifunc|glGetShader}} with argument {{enum|GL_SHADER_SOURCE_LENGTH}} | |||
{{apifunc|glIsShader}} | |||
== See Also == | == See Also == | ||
{{apifunc|glCreateShader}}, {{apifunc|glShaderSource}} | |||
== Copyright == | == Copyright == | ||
Line 47: | Line 47: | ||
Copyright © 2003-2005 3Dlabs Inc. Ltd. 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/ http://opencontent.org/openpub/]. | Copyright © 2003-2005 3Dlabs Inc. Ltd. 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/ http://opencontent.org/openpub/]. | ||
[[Category:Core API Reference|GetShaderSource]] | [[Category:Core API Reference|GetShaderSource]] | ||
[[Category:Core API Ref Shader Program Creation|GetShaderSource]] | |||
[[Category:Shader Object API State Functions|GetShaderSource]] |
Latest revision as of 10:01, 15 August 2013
Core in version | 4.6 | |
---|---|---|
Core since version | 2.0 |
glGetShaderSource: Returns the source code string from a shader object
Function Definition
void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
- shader
- Specifies the shader object to be queried.
- bufSize
- Specifies the size of the character buffer for storing the returned source code string.
- length
- Returns the length of the string returned in source (excluding the null terminator).
- source
- Specifies an array of characters that is used to return the source code string.
Description
glGetShaderSource returns the concatenation of the source code strings from the shader object specified by shader. The source code strings for a shader object are the result of a previous call to glShaderSource. The string returned by the function will be null terminated.
glGetShaderSource returns in source as much of the source code string as it can, up to a maximum of bufSize characters. The number of characters actually returned, excluding the null termination character, is specified by length. If the length of the returned string is not required, a value of NULL can be passed in the length argument. The size of the buffer required to store the returned source code string can be obtained by calling glGetShader with the value GL_SHADER_SOURCE_LENGTH.
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 bufSize is less than 0.
Associated Gets
glGetShader with argument GL_SHADER_SOURCE_LENGTH
See Also
glCreateShader, glShaderSource
Copyright
Copyright © 2003-2005 3Dlabs Inc. Ltd. 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/.