这是我目前使用的环境:Eclipse-Luna, C++11在Linux Mint-Rebecca上。
当我尝试使用现代OpenGL,如VAOs或VBOs时,我会遇到编译器错误,例如无法解析方法。
例如:
当我尝试使用现代OpenGL,如VAOs或VBOs时,我会遇到编译器错误,例如无法解析方法。
例如:
GLuint VaoID; //GLuint is working
glGenVertexArrays(1, &VaoID);
或者:
GLuint VboID;
glGenBuffers(1, &VboID);
glBindBuffer(GL_ARRAY_BUFFER, VboID);
glBufferData(GL_ARRAY_BUFFER, vbo_size, data, usage);
我查看了GL/gl.h和GL/glext.h文件,发现只有OpenGL 1.x的方法。
然后我检查了我的OpenGL版本,使用命令glxinfo|grep "OpenGL"。看起来一切都正常:
glxinfo|grep "OpenGL"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.1.3
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
尝试再次安装或更新软件包时,只会指出一切都是最新的。
sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libglew1.5-dev' for regex 'libglew1.5'
Note, selecting 'libglew-dev' instead of 'libglew1.5-dev'
Note, selecting 'libglew-dev' instead of 'libglew1.5-dev'
freeglut3 is already the newest version.
freeglut3-dev is already the newest version.
libglew-dev is already the newest version.
libglu1-mesa is already the newest version.
libglu1-mesa-dev is already the newest version.
libgl1-mesa-dev is already the newest version.
libgl1-mesa-glx is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 150 not upgraded.
那么,有没有一种方法可以在不手动更改包含目录的情况下解决这个问题呢?
如果没有,我该如何获取适合我的OpenGL版本的最新标头文件呢?
#include <GL/glew.h>
并使用-lGLEW
编译后,您是否仍然遇到此错误?我在这里尝试过,GLEW 具有所提到的方法。另外,请检查这些答案是否有帮助。 - wendelbsilva