Hi,
I am currently trying to get PBOs to work, but there is something wrong and I can’t figure out what…
I create the PBO and upload some data into it:
GLuint buffer[1];
glGenBuffers(1, &buffer[0]);
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer[0]);
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, size, data, GL_DYNAMIC_COPY);
“size” is the length of the data chunk, where the pointer “data” points to.
For debugging I am printing out the size of the buffer:
int bs=0;
glGetBufferParameteriv(GL_PIXEL_PACK_BUFFER_ARB, GL_BUFFER_SIZE, &bs);
std::cout << "buffer size: " << bs << std::endl;
Result: 0. But why? Any ideas, what’s going wrong here? I do several calls to GetLastError(), but everything seems to work fine…
Also this isn’t working yet, there is another question bothering me: How to upload the data from a PBO to a texture object? Is this the correct way:
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, buffer[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
Thanks for your answers!
fallen