GLSHADERSOURCE(3G)
π GLSHADERSOURCE π
okay so welcome to the 3G manual page for glShaderSource, bestie. This is the one where OpenGL takes your shader source and just... copies it into the shader object. No parsing, no scanning, no little compiler goblin at this stage. β¨ iconic behavior β¨
πΈ NAME πΈ
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β the handle of the shader object whose source code is gonna be replaced. This is the main character here.countβ how many elements are in thestringandlengtharrays. Like, the group-chat member count.stringβ an array of pointers to strings that hold the source code you're loading into the shader.lengthβ 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 that was already stored in the shader object is completely replaced β old source? gone, bestie. 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. Periodt. π
π§ 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. That's the good stuff β no dangling source-string anxiety. π«Ά
π ERRORS π
GL_INVALID_VALUEis generated ifshaderis not a value generated by OpenGL.GL_INVALID_OPERATIONis generated ifshaderis not a shader object.GL_INVALID_VALUEis generated ifcountis less than0.
π ASSOCIATED GETS π
glGetShader()with argumentsshaderandGL_SHADER_SOURCE_LENGTHglGetShaderSource()with argumentshaderglIsShader()
π VERSION SUPPORT π
The OpenGL Version columns are: 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5.
For the Function / Feature Name row: glShaderSource has a β in every single one of those versions. All of them. Every. Single. One. πβ¨
π 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/.
π COPYRIGHT π
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group
okay bye bestie! This page is from the 3G manual, and its source/version is [FIXME: source], dated 08/09/2021. Go replace some shader source and slay. πβ¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms