GLCREATESHADER(3G)
π GLCREATESHADER(3G) π
okay so bestie, we're in the 3G manual today, and this little icon is glCreateShader β literally the function that makes shader objects out of thin air. let's get into it π
β¨ NAME β¨
glCreateShader β creates a shader object. that's it, that's the vibe π¦
β¨ C SPECIFICATION β¨
GLuint glCreateShader(GLenum shaderType);
β¨ PARAMETERS β¨
shaderTypeβ tells the universe what kind of shader you're making. it has to be one ofGL_COMPUTE_SHADER,GL_VERTEX_SHADER,GL_TESS_CONTROL_SHADER,GL_TESS_EVALUATION_SHADER,GL_GEOMETRY_SHADER, orGL_FRAGMENT_SHADER. no substitutions, no "close enough", no cap π«Ά
β¨ DESCRIPTION β¨
so like, glCreateShader creates an empty shader object and hands you back a non-zero value that you use to reference it later. think of it as a little locker where you're gonna store the source code strings that define a shader π¦β¨
shaderType is what tells it which flavor of shader to create. the page says five types of shader are supported β and then lists six, but we're not gonna fight the manpage, we're gonna love it π. here's the whole roster:
- a shader of type
GL_COMPUTE_SHADERis intended to run on the programmable compute processor. - a shader of type
GL_VERTEX_SHADERis intended to run on the programmable vertex processor. - a shader of type
GL_TESS_CONTROL_SHADERis intended to run on the programmable tessellation processor in the control stage. - a shader of type
GL_TESS_EVALUATION_SHADERis intended to run on the programmable tessellation processor in the evaluation stage. - a shader of type
GL_GEOMETRY_SHADERis intended to run on the programmable geometry processor. - a shader of type
GL_FRAGMENT_SHADERis intended to run on the programmable fragment processor.
and the second you create it, the shader object's GL_SHADER_TYPE parameter gets set to whichever of GL_COMPUTE_SHADER, GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER or GL_FRAGMENT_SHADER you passed in. it knows what it is. main character energy from birth ππ
β¨ NOTES β¨
- like buffer and texture objects, the name space for shader objects may be shared across a set of contexts, as long as the server sides of the contexts share the same address space. if the name space is shared across contexts, then any attached objects β and the data associated with those attached objects β are shared too. everything's shared. we're all in the group chat π«
- applications are responsible for providing the synchronization across API calls when objects are accessed from different execution threads. so like... you gotta handle that yourself, bestie. it's giving "you're on your own" π
- >
GL_COMPUTE_SHADERis available only if the GL version is4.3or higher. do not come for it on 4.2, it will not be there π
β¨ ERRORS β¨
- this function returns
0if an error occurs while creating the shader object. zero. nada. nothing. sad girl hours π GL_INVALID_ENUMis generated ifshaderTypeis not an accepted value. so if you passed something silly, that's on you π₯
β¨ ASSOCIATED GETS β¨
glGetShader()β with a valid shader object and the parameter to be queriedglGetShaderInfoLog()β with a valid shader objectglGetShaderSource()β with a valid shader objectglIsShader()
β¨ VERSION SUPPORT β¨
the original had this whole grid situation, but the tea is simple: glCreateShader is a full checkmark girlie across the board π
β
- OpenGL
2.0β supported β - OpenGL
2.1β supported β - OpenGL
3.0β supported β - OpenGL
3.1β supported β - OpenGL
3.2β supported β - OpenGL
3.3β supported β - OpenGL
4.0β supported β - OpenGL
4.1β supported β - OpenGL
4.2β supported β - OpenGL
4.3β supported β - OpenGL
4.4β supported β - OpenGL
4.5β supported β
(the function/feature name in that table was glCreateShader, obviously. it ate. no notes. πβ)
β¨ SEE ALSO β¨
glAttachShader()glCompileShader()glDeleteShader()glDetachShader()glShaderSource()
go read those next, i'm obsessed with you learning π§π
β¨ 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 that's the whole page, go forth and shader β¨π
and for the cute sign-off bestie: the footer credits [FIXME: source] (iconic placeholder behavior, we respect it) and it's dated 08/09/2021 β so this tea is from august ninth, twenty twenty-one. periodt ππ¦
π¦ 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