View Full Version : Problem with PBOs

08-31-2005, 09:01 AM

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!


Nicolas Lelong
08-31-2005, 10:44 PM
Originally posted by The_Fallen:
I do several calls to GetLastError()Hi, FWIW, I presume it's a typo but, to get GL errors, you have to call glGetError not GetLastError...

09-01-2005, 12:18 AM
Oh damn... yeah, it's a typo, unfortunately not only in the posting, but also in the source code... That's the reason, why copy&paste is really bad, especially when mixing Win32API and OpenGL calls...
Thanks, I hope that I now find the error in the code. Or has anyone an idea, what's going wrong there?