I'm learning OpenGL on Fedora 13 and noticed that a call to glGetString is causing a seg fault. I've scraped Google, but come up with no solutions.
The code is simple:
#include <GL/gl.h>
int main() {
glGetString(GL_VERSION);
return 0;
}
Compile Command:
g++ -lGL main.cpp -o test.bin
Run result:
$ ./test.bin
Segmentation fault (core dumped)
OpenGL Info:
$ glxinfo | grep OpenGL
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) IGDNG_M GEM 20100328 2010Q1
OpenGL version string: 2.1 Mesa 7.8.1
OpenGL shading language version string: 1.20
OpenGL extensions:
Any ideas or references are greatly appreciated.
Solution:
#include <iostream>
#include <GL/freeglut.h>
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutCreateWindow("test");
glutFullScreen();
std::cout << glGetString(GL_VERSION) << std::endl;
return 0;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…