'glCreateShader'没有在这个范围内声明? [英] 'glCreateShader' was not declared in this scope?
问题描述
为什么会出现这些错误?
错误:'GL_VERTEX_SHADER'未在此范围内声明
错误:'glCreateShader'未在此范围内声明
代码:
GLuint vs = glCreateShader(GL_VERTEX_SHADER);
是的,我有包含过量。
>
CreateShader
不在GLUT中,而是在OpenGL 2.0中。如果由于某种原因或者你的GL版本小于2.0,你的包括过度不包括 gl.h
,头文件不会声明它。 我也会检查你的 gl.h
看看 CreateShader
实际上声明了。
编辑:这个OpenGL头版本的东西似乎是一个普遍的问题在Windows。大多数人建议您使用 GLEW 或其他扩展加载程序库来绕过它。
Why am I getting these errors?
error: 'GL_VERTEX_SHADER' was not declared in this scope
error: 'glCreateShader' was not declared in this scope
Code:
GLuint vs = glCreateShader(GL_VERTEX_SHADER);
And yes, I do have the includes to glut.
What does glGetString(GL_VERSION)
return?
CreateShader
is not in GLUT but OpenGL 2.0. If your "includes to glut" are not including gl.h
for some reason or your GL version is less than 2.0, the headers will not declare it.
I'd also check your gl.h
to see if CreateShader
is actually declared there.
Edit: This OpenGL header version thing seems to be a general problem in Windows. Most people suggest using GLEW or another extension loader library to get around it.
这篇关于'glCreateShader'没有在这个范围内声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!