简体   繁体   English

glCreateProgram访问冲突执行位置0x00000000

[英]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.

相关问题 0xC0000005:访问冲突执行位置0x00000000 - 0xC0000005: Access violation executing location 0x00000000 openGL:glGenVertexArrays访问冲突执行位置0x00000000 - openGL: glGenVertexArrays Access violation executing location 0x00000000 访问冲突写入位置0x00000000 - Access violation writing location 0x00000000 访问冲突写入位置 0x00000000 - Access violation writing location 0x00000000 在 Project0_opengl.exe 中的 0x00000000 处抛出异常:0xC0000005:访问冲突执行位置 0x00000000 - Exception thrown at 0x00000000 in Project0_opengl.exe: 0xC0000005: Access violation executing location 0x00000000 在 CobwebDiagram.exe 中的 0x00000000 处引发异常:0xC0000005:访问冲突执行位置 0x00000000 - Exception thrown at 0x00000000 in CobwebDiagram.exe: 0xC0000005: Access violation executing location 0x00000000 C ++中带有函数指针的异常:访问冲突执行位置0x00000000 - Exception in C++ with function pointers: Access violation executing location 0x00000000 访问冲突在二叉搜索树中读取位置0x00000000 - Access violation reading location 0x00000000 in binary search tree 填充数组(访问冲突写入位置0x00000000) - Filling an array (Access violation writing location 0x00000000) 0xC0000005:访问冲突读取位置0x00000000 - 0xC0000005: Access violation reading location 0x00000000
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM