Pixel Buffer Objects woes continue, ATI this time

All,

I was wondering if anyone out there has successfully used Pixel Buffer Objects on the very latest ATI graphics card drivers. As best I can tell, every glTexSubImage call will fail. For instance, the following code shows the problem:

[b]GLuint pbo;
::glGenBuffers( 1, &pbo );
::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
::glBufferData( GL_PIXEL_UNPACK_BUFFER, 5125124, 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 );
::glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 512, 512, GL_BGRA, GL_UNSIGNED_BYTE, NULL );
assert( ::glGetError() == GL_NO_ERROR );[/b]

Indeed, if you look at the sample code “Streaming textures using pixel buffer objects” :
http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt

and then put a :

assert( glGetError() == GL_NO_ERROR );

after the SubTexSubImage call it will not succeed.

Am I going insane, or is something this basic really a problem ?

Andrew

::glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 ); // Comment this line out and this code works !

Of course it will work if you comment out this line, because with this line you unbind the pixel buffer object, so when you call glTexImage2D OpenGL won’t use any PBO because there isn’t one bound, so it will try to load the texture image from memory address 0 (NULL). That would make a problem.
The OpenGL specification doesn’t mention exactly what happens when you pass a NULL pointer to glTexImage2D after you’ve used PBOs.
Of course it’s not a problem with the code but with the spec.

http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html


In GL version 1.1 or greater, pixels may be a null pointer.
In this case texture memory is allocated to accommodate a
texture of width width and height height.  You can then
download subtextures to initialize this texture memory. The
image	is undefined if	the user tries to apply	an
uninitialized	portion	of the texture image to	a primitive.

So… above code should not assert. My guess it is driver bug.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.