opengl 仅GL_COLOR_BUFFER_BIT的访问冲突

yyyllmsg  于 2022-11-04  发布在  其他
关注(0)|答案(1)|浏览(176)

Unhandled exception in 0x7B372F75 (ig9icd32.dll) in forespend.exe: 0xC0000005: access violation writing to location 0x07E00000.我试着运行glClear(GL_COLOR_BUFFER_BIT);,但它返回了这个错误,我的程序继续运行和工作,但似乎它不能正常工作,由于这个错误。glClear是与其他标签内的它像GL_DEPTH_BUFFER_BIT和其他人。在调试没有问题显示,错误只是出现在中间的代码像这样:

如果存在一个替代GL_COLOR_BUFFER_BIT的id就像知道一样。
代码:


# include<GL/glfw3.h>

# include<map>

# include<iostream>

# include<stdio.h>

# include<chrono>

# include<stdlib.h>

# define WIDTH 320

# define HEIGHT 200

struct key {

};

GLFWwindow* window;
GLFWmonitor* monitor;
bool running = 1, windowed;
std::map<int, key> keyMap;

void update(){}

void input(){}

void draw(){
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);
}

int main() {
    glfwWindowHint(GLFW_SAMPLES, 1);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    if (!glfwInit()) fprintf(stderr, "opengl error\n");
    window = glfwCreateWindow(WIDTH, HEIGHT, "end", NULL, NULL);
    if (window == NULL) {std::cout << "window error\n" << std::endl; glfwTerminate();}
    glfwMakeContextCurrent(window);
    monitor = glfwGetPrimaryMonitor();

    while (running)
    {
        update();
        input();
        draw();
    }

    glfwDestroyWindow(window);
    glfwTerminate();

}
jhkqcmku

jhkqcmku1#

嗯...我找了任何解决方案,和英特尔支持部门谈过,结果他们说我需要和我的笔记本电脑供应商一起获得驱动程序(三星)由于安装的windows是安装在fabric中的,我试图用三星update更新驱动程序,它安装了一个旧的驱动程序。错误不断发生,由于我这周开始使用OpenGL,从一开始就遇到了这个问题,现在我决定换到另一个渲染器,那就是Vulkan.It现在工作得很好,所以如果你是OpenGL新手,遇到了这个问题,我认为Vulkan是一个很好的选择来克服这一点,因为它运行速度更快,并有一个伟大的兼容性与windows,ios,linux和android,如果代码是为旧机器或你真的需要opengl,所以我必须说,你需要一个虚拟机为此不幸。在我的情况下,我不能使用虚拟机,因为这本笔记本电脑是低规格

相关问题