c++ - 自从移动到 64 位后,我在随机 glVertexAttribArray 调用中从 nvoglv64.dll 获得了访问冲突

标签 c++ opengl

<分区>

标题上说的是真的。将我所有的库和包含移动到 64 位以使我能够在 64 位中使用 assimp,但现在我随机从 nvogl64.dll 中获得访问冲突。它总是在 glVertexAttribPointer 调用中,但是随机的,有时我可以运行整整 30 分钟,大部分时间是第一次或第二次调用它。我做错了什么?为了完整性,这是我的 VAO 生成方法。

GLuint vertsVBO = 0;
GLuint normsVBO = 0;
GLuint textsVBO = 0;

GLuint shapeVAO = 0;

//Make the VAO
glGenVertexArrays(1, &shapeVAO);
glBindVertexArray(shapeVAO);


//Setup the Vertex buffer
glGenBuffers(1, &vertsVBO);
glBindBuffer(GL_ARRAY_BUFFER, vertsVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float*)*uniqueVertexes * 3, indexedPoints, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glEnableVertexAttribArray(0);


//The normal Buffer
glGenBuffers(1, &normsVBO);
glBindBuffer(GL_ARRAY_BUFFER, normsVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float*)*uniqueVertexes * 3, indexedNorms, GL_STATIC_DRAW);
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glEnableVertexAttribArray(2);


//and the texture co-ord buffer
glGenBuffers(1, &textsVBO);
glBindBuffer(GL_ARRAY_BUFFER, textsVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float*)*uniqueVertexes * 2, indexedTexts, GL_STATIC_DRAW);
glVertexAttribPointer(8, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glEnableVertexAttribArray(8);


glGenBuffers(1, &tangentsVBO);
glBindBuffer(GL_ARRAY_BUFFER, tangentsVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float*)*uniqueVertexes * 4, indexedTangents, GL_STATIC_DRAW);
glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glEnableVertexAttribArray(3);

glGenBuffers(1, &bitangentsVBO);
glBindBuffer(GL_ARRAY_BUFFER, bitangentsVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float*)*uniqueVertexes * 4, indexedBitangents, GL_STATIC_DRAW);
glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glEnableVertexAttribArray(4);

glGenBuffers(1, &indicesVBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indicesVBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesLength * sizeof(GLuint), indices, GL_STATIC_DRAW);


//Unbind VAO
glBindVertexArray(0);

谢谢

最佳答案

你确定吗?

sizeof(float*)

我以为你会加载 float (而不是指针)

glBufferData(GL_ARRAY_BUFFER, sizeof(float)*uniqueVertexes * 3, indexedNorms, GL_STATIC_DRAW);

关于c++ - 自从移动到 64 位后,我在随机 glVertexAttribArray 调用中从 nvoglv64.dll 获得了访问冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57780238/

相关文章:

c++ - std::experimental::source_location 如何实现?

opengl - 右手系统中的 Lookat 函数的结果应该是什么?

c - GLSL:用旋转 vector 旋转?

C++管道用多个程序修改输入文件

c++ - ISR 中使用的循环缓冲区声明为 volatile ,会产生错误。为什么 ?如何解决这个问题?

c++ - For 循环变量似乎无缘无故地走向 hell ?

c++ - 链接器中不必要的链接库

代码:: block 、过剩和 OpenGL

c++ - 如何在opengl中停止拉伸(stretch)

C OpenGL glfw3 三角形不显示