Greetings,
I am trying to upload a 3D texture using PBO. I can’t get it to work. No GL error is generated, but the texture doesn’t become resident, and I get blank quads when rendering.
My code:
glGenTextures(1, &m_unColourTextureName);
glGenBuffers(1, &m_unColourTexturePBO);
glBindTexture(GL_TEXTURE_3D, m_unColourTextureName);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, m_unColourTexturePBO);
glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, 512*512*128, NULL, GL_STREAM_DRAW);
// load the texture
pData = glMapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY);
// copy texture-content
...
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
glBindTexture(GL_TEXTURE_3D, m_unColourTextureName);
glTexSubImage3D(
GL_TEXTURE_3D, // target
0, // level
0, 0, 0,
m_nTexWidth, // width
m_nTexHeight, // height
m_nTexDepth, //depth
GL_LUMINANCE, // format
GL_UNSIGNED_BYTE, // type
BUFFER_OFFSET(0)
);
GLboolean bResident;
GLboolean bSuccess = glAreTexturesResident(1, &m_unColourTextureName, &bResident);
(does not return GL_TRUE)
Any suggestions?
thanks!