我不断得到
atioglxx.pdb未加载错误
抛出的异常是
opengl_fps.exe中0x61DA5D3A(atioglxx.dll)的未处理异常: 0xC0000005:访问冲突写入位置0x00000000。发生
在我添加了一些用于加载一些着色器和绘制三角形的代码之后,这开始发生
我已经准备尝试更新我的AMD驱动程序,清理解决方案并重建,重新启动Visual Studio,重新启动我的PC并对其进行谷歌搜索
用于加载着色器的代码
GLuint vsid = glCreateShader(GL_VERTEX_SHADER);\\exception thrown here
glShaderSource(vsid, 1, &vs, NULL);
glCompileShader(vsid);
GLint* success = 0;
GLchar infolog[512];
glGetShaderiv(vsid, GL_COMPILE_STATUS, success);
if (!success)
{
glGetShaderInfoLog(vsid, 512, NULL, infolog);
std::cout << "shader vs cant compile\n" << infolog << std::endl;
}
GLuint fsid = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fsid, 1, &fs, NULL);
glCompileShader(fsid);
glGetShaderiv(fsid, GL_COMPILE_STATUS, success);
if (!success)
{
glGetShaderInfoLog(vsid, 512, NULL, infolog);
std::cout << "shader fs cant compile\n" << infolog << std::endl;
}
GLuint shaderprogram = glCreateProgram();
glAttachShader(shaderprogram, vsid);
glAttachShader(shaderprogram, fsid);
glLinkProgram(shaderprogram);
glGetProgramiv(shaderprogram, GL_LINK_STATUS, success);
if (!success)
{
glGetShaderInfoLog(shaderprogram, 512, NULL, infolog);
std::cout << "shader program" << infolog;
}
glDeleteShader(vsid);
glDeleteShader(fsid);
GLfloat vertices[] = {
-0.5f,-0.5f,0.0f,
0.5f,-0.5f,0.0f,
0.0f,0.5f,0.0f
};
GLuint vbo, vao;
glGenVertexArrays(1, &vao);
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GL_FLOAT), (GLvoid*)0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
渲染代码
win.update();
glUseProgram(shaderprogram);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
win.swapbuffers();
答案 0 :(得分:1)
glGetShaderiv
的3参数期望将传递空指针作为要使用的地址的GLint
的地址。
更改:
GLint* success = 0;
GLchar infolog[512];
glGetShaderiv(vsid, GL_COMPILE_STATUS, success);
收件人:
GLint success = 0;
GLchar infolog[512];
glGetShaderiv(vsid, GL_COMPILE_STATUS, &success);
以及其他类似的地方。