PDA

View Full Version : PBO causing OpenGL out of memory warnings



mlop3s
07-13-2012, 03:07 AM
Hi,
I’m experiencing a OpenGL out of memory problem using a Nvidia Geforce GT 240. The problem seems to come up, only when I use PBO to update the texture. I’m updating it with videos of different sizes all the time. The videos have different sizes.
Using the following code to update causes no error:


glTexSubImage2D(_nTextureTarget, 0, 0, 0,
_width, _height, lTextureFormat(),
TextureType(), m_Buffer);

However, if I use PBO, I get a OpenGL out of memory after some hours. The videos are played in a loop and shown as Quad-Texture (the same applies above)
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, _hPixelBuffer);


unsigned char * pPixelData = static_cast< unsigned char*>
(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY));

if (pPixelData != NULL) {
CopySource(pPixelData); // memcopy basically
if (!glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)) {
// log – error handling
}
glEnable(_nTextureTarget);
glBindTexture(_nTextureTarget, _hTexture);
glTexSubImage2D(_nTextureTarget, 0, 0, 0, m_resizedWidth ,
m_resizedHeight, _oImage.glTextureFormat(), _oImage.glTextureType(),
BUFFER_OFFSET(0));
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
} else {
// log – error handling
}

The thing is, if I would be copying beyond the boundaries, I would get a different error, and this is not the case. The application works well for some hours, and then starts sending warning on the EventLog from windows 7. I’ve updated the Nvidia driver to “302.82-desktop-win8-32bit-english” .

Is it a Driver problem or am I doing a mistake ? Can I kind of force “garbage collection” if there is any?

I can’t see where I’m allocating more memory. The PBO is created only once ans uses 4096x4096x4, and then it’s updated all the time.