我使用GLEW和freeglut。 出于某种原因,于glewInit(),glGetError()调用之后返回错误代码1280,即使采用glewExperimental = GL_FALSE。
我不能编译着色器,glGetProgramInfoLog()返回“顶点着色器(一个或多个)未glLinkProgram之前成功编译()被调用,连接失败。” 我能之前编译着色器。
重新安装驱动程序并没有帮助。
这里是我的代码:
int main(int argc, char* argv[])
{
GLenum GlewInitResult, res;
InitWindow(argc, argv);
res = glGetError(); // res = 0
glewExperimental = GL_TRUE;
GlewInitResult = glewInit();
fprintf(stdout, "ERROR: %s\n", glewGetErrorString(GlewInitResult)); // "No error"
res = glGetError(); // res = 1280
glutMainLoop();
exit(EXIT_SUCCESS);
}
void InitWindow(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitContextVersion(4, 0);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,
GLUT_ACTION_GLUTMAINLOOP_RETURNS);
glutInitWindowPosition(0, 0);
glutInitWindowSize(CurrentWidth, CurrentHeight);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
WindowHandle = glutCreateWindow(WINDOW_TITLE);
GLenum errorCheckValue = glGetError();
if (WindowHandle < 1)
{
fprintf(stderr, "ERROR: Could not create new rendering window.\n");
exit(EXIT_FAILURE);
}
glutReshapeFunc(ResizeFunction);
glutDisplayFunc(RenderFunction);
glutIdleFunc(IdleFunction);
glutTimerFunc(0, TimerFunction, 0);
glutCloseFunc(Cleanup);
glutKeyboardFunc(KeyboardFunction);
}
我做错了吗?