Problem with latest drivers and pixel buffer objects.
All,
I have run into what looks like a pretty critical problem with PBOs on the latest ATI/AMD OpenGL drivers when you try to upload using a glTexSubImage. Basically the following code will fail :
GLuint pbo;
::glGenBuffers( 1, &pbo );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
::glBufferData( GL_PIXEL_UNPACK_BUFFER, 512*512*4, 0, GL_STREAM_DRAW );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 ); // Comment this line out and this code works !
GLuint tx;
::glGenTextures( 1, &tx );
::glBindTexture( GL_TEXTURE_2D, tx );
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
void* p_mem = ::glMapBuffer( GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY );
::glUnmapBuffer( GL_PIXEL_UNPACK_BUFFER );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
::glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
assert( ::glGetError() == GL_NO_ERROR );
Indeed, even using the reference code in the specifications, "Streaming textures using pixel buffer objects" :
http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt
will fail if you put an assert( glGetError() == GL_NO_ERROR ); after the SubImage call.
I could be missing something here, but this seems like quite a serious problem.
Thanks in advance for any help.
Andrew Cross, Ph.D
VP of SW Engineering,
NewTek, www.newtek.com
p.s. Is there a bug database that I could post this too ?