我在Linux Mint 13 XFCE上.我的问题是,当我在终端运行命令时:
glxinfo | grep "OpenGL version"
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
OpenGL version string: 3.3.0 NVIDIA 295.40
Run Code Online (Sandbox Code Playgroud)
但是当我glGetString(GL_VERSION)在我的应用程序中运行时,结果为null.为什么这段代码没有得到gl_version?
#include <stdio.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/glext.h>
int main(int argc, char **argv) {
glutInit(&argc, argv);
glewInit();
printf("OpenGL version supported by this platform (%s): \n",
glGetString(GL_VERSION));
}
Run Code Online (Sandbox Code Playgroud)