我是OpenGL的新手,并尝试按照http://www.openglbook.com教程学习OpenGL 4 .在第二页,我们使用着色器创建一个简单的三角形.但是在创建顶点着色器之后,程序崩溃了.通过调试,我可以找到一个OpenGL错误GL_INVALID_ENUM(0x0500).见下面的代码......
不幸的是,我找不到任何解决方案.也许你知道吗?
编辑:
所以,再次搜索后GL_INVALID_ENUM和glewInit(),我发现已经有其他网站上的很多帖子,但:他们大多有一些错别字其着色器和我绝对没有.在
http://www.opengl.org/wiki/OpenGL_Loading_Library上
我发现:
您可能仍然会得到GL_INVALID_ENUM(取决于您使用的GLEW的版本),但至少GLEW会忽略glGetString(GL_EXTENSIONS)并获取所有函数指针.
有人建议只是忽略错误,但我仍然无法运行该程序...顺便说一句,你们中的任何人都可以尝试运行该程序吗?如果你有同样的错误,我们肯定知道它不是我的IDE/Project配置错误.
眼镜:
Windows 8.1 64bit
Intel Core i7-3517U with
Intel HD4000 GPU (OpenGL 4.0.0 Support)
8 GB RAM
Run Code Online (Sandbox Code Playgroud)
IDE:
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 1
Build id: 20130919-0819
using MinGW Compiler
Run Code Online (Sandbox Code Playgroud)
码:
#include <stdlib.h>
#include <stdio.h>
#include <string>
#define GLEW_STATIC
#include <gl/glew.h>
#include <gl/freeglut.h>
#define WINDOW_TITLE_PREFIX "Chapter 2"
// initialization
int CurrentWidth = 800,
CurrentHeight = 600,
WindowHandle = …Run Code Online (Sandbox Code Playgroud)