13 template<GLenum ShaderType>
14 inline shader_base<ShaderType>::~shader_base()
16 glDeleteShader(m_nShader);
19 template<GLenum ShaderType>
27 m_nShader = glCreateShader(ShaderType);
28 glShaderSource(m_nShader, 1, &pszShaderCode,
nullptr);
29 glCompileShader(m_nShader);
32 if (
const GLint bSuccess = GetParameter(GL_COMPILE_STATUS); !bSuccess)
34 GLsizei nErrorStringLength = 0;
35 glGetShaderiv(m_nShader, GL_INFO_LOG_LENGTH, &nErrorStringLength);
37 if (nErrorStringLength > 0)
39 sError.
assign(nErrorStringLength,
'\0');
40 glGetShaderInfoLog(m_nShader, nErrorStringLength,
nullptr, sError.data());
46 sError =
"Nullptr passed as shader text pointer";
53 template<GLenum ShaderType>
59 template<GLenum ShaderType>
63 glGetShaderiv(m_nShader, eParameter, &nRet);
void assign(size_type nSymbols, value_type chSymbol) noexcept
Assign by filling.
GLuint GetID() const
Get shader name.
GLint GetParameter(GLenum eParameter) const
Get shader parameter.
string Init(const GLchar *pszShaderCode)
Init (compile) shader.
string to_string(cstring_view stringView, const std::locale &locale=std::locale())
Convert a char string to common string type.