[英]glCreateProgram Access violation executing location 0x00000000
I have initialized GLFW and i can call other gl functions. 我已经初始化了GLFW,我可以调用其他gl函数。 It is possible to draw faces using the OpenGL pipeline.
可以使用OpenGL管道绘制面。 It, however gives me this error when executing
glCreateProgram()
. 但是,它在执行
glCreateProgram()
时给了我这个错误。
Error: 错误:
Exception thrown at 0x00000000 in Voxel.exe: 0xC0000005: Access violation executing location 0x00000000.
在Voxel.exe中的0x00000000处引发异常:0xC0000005:执行访问位置0x00000000的访问冲突。
Simplified code: 简化代码:
void error_callback(int error, const char* description)
{
cerr << description << endl;
}
[...]
if (!glfwInit())
{
cout << "Failed to create GLFW3 / OpenGL context";
system("PAUSE");
exit(EXIT_FAILURE);
}
else
cout << "GLFW3 initialized!" << endl;
glfwSetErrorCallback(error_callback);
glFrontFace(GL_CW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
width = 600;
height = 600;
this->window = glfwCreateWindow(width, height, "voxel", NULL, NULL);
glfwSetWindowSize(this->window, width, height);
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
if (!this->window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(this->window);
glfwSwapInterval(0);
cout << "OpenGL version: " << glGetString(GL_VERSION) << endl;
GLuint program = glCreateProgram();
[...]
I do not see, why this is happening. 我不明白为什么会这样。
GLFW doesn't load extensions and modern functionality for you. GLFW不会为您加载扩展程序和现代功能。 Hence glCreateProgram is uninitialized.
因此glCreateProgram未初始化。
You need an actual extension loader. 您需要一个实际的扩展程序加载器。 Also you have to check that glCreateProgram et al.
另外,您还必须检查glCreateProgram等。 are actually supported by your target system.
实际上受您的目标系统支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.