'glCreateShader'没有在这个范围内声明? [英] 'glCreateShader' was not declared in this scope?

查看:1818
本文介绍了'glCreateShader'没有在这个范围内声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么会出现这些错误?


错误:'GL_VERTEX_SHADER'未在此范围内声明


错误:'glCreateShader'未在此范围内声明


代码:

  GLuint vs = glCreateShader(GL_VERTEX_SHADER); 

是的,我有包含过量。

glGetString(GL_VERSION)



> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆