我在LinuxMint 13 XFCE上。我的问题是,当我在终端运行时,命令:
glxinfo | grep "OpenGL version"
我得到以下输出:
OpenGL version string: 3.3.0 NVIDIA 295.40
但在我的应用程序中当我运行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));
}
发布于 2018-02-13 08:28:26
试试这个:
#include <GL/glew.h>
#include <GL/glut.h>
#include <cstdio>
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutCreateWindow("GLUT");
glewInit();
printf("OpenGL version supported by this platform (%s): \n", glGetString(GL_VERSION));
}
https://stackoverflow.com/questions/-100003487
复制相似问题