glGetTexImage 访问冲突
glGetTexImage ACCESS VIOLATION
当我在 Framebuffer
的纹理上调用 glGetTexImage()
时,出现此错误:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffabf967a2b, pid=1816, tid=14712
这是我的代码:
MagicaAdventura.GAME.gameBuffer.bindTexture();
glGetTexImage(GL_TEXTURE_2D, 0, GL12.GL_BGR, GL_UNSIGNED_BYTE, buf);//line that causes the error
这里是绑定方法的代码:
public void bind(int texture) {
if(currentBound[texture] != resource.getID() || lastBoundInFramebuffer != Renderer.CURRENT_FRAMEBUFFER) {
GL13.glActiveTexture(GL13.GL_TEXTURE0 + texture);
lastBoundInFramebuffer = Renderer.CURRENT_FRAMEBUFFER;
currentBound[texture] = resource.getID();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, resource.getID());
}
}
纹理绑定代码适用于其他方面。
缓冲区没有为填充纹理分配 space 到 2 的幂,所以我改用 glReadPixels
.
当我在 Framebuffer
的纹理上调用 glGetTexImage()
时,出现此错误:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffabf967a2b, pid=1816, tid=14712
这是我的代码:
MagicaAdventura.GAME.gameBuffer.bindTexture();
glGetTexImage(GL_TEXTURE_2D, 0, GL12.GL_BGR, GL_UNSIGNED_BYTE, buf);//line that causes the error
这里是绑定方法的代码:
public void bind(int texture) {
if(currentBound[texture] != resource.getID() || lastBoundInFramebuffer != Renderer.CURRENT_FRAMEBUFFER) {
GL13.glActiveTexture(GL13.GL_TEXTURE0 + texture);
lastBoundInFramebuffer = Renderer.CURRENT_FRAMEBUFFER;
currentBound[texture] = resource.getID();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, resource.getID());
}
}
纹理绑定代码适用于其他方面。
缓冲区没有为填充纹理分配 space 到 2 的幂,所以我改用 glReadPixels
.