PDA

View Full Version : PBO texture not resident



clunis_immensus
03-27-2009, 09:02 PM
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!

ruysch
03-28-2009, 01:45 PM
First create the texture, see man page on glTexImage3D to allocate a 3D texture.

http://linux.die.net/man/3/glteximage3d

clunis_immensus
04-07-2009, 01:59 AM
thanks for spotting that!