loading a texture

Started by emzic, September 16, 2009, 20:32:28

Previous topic - Next topic

emzic

hello, i am getting this error when i try to create a texture from a bytebuffer:

"Cannot use Buffers when Pixel Unpack Buffer Object is enabled"

i am calling the function like this:

GL11.glGenTextures(1, texb);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texb.get(0));
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 128, 128, 0, GL11.GL_RGBA, GL.GL_UNSIGNED_BYTE, byteBuffer);

what could be the problem here? thanks!

Kai

It means that somewhere in your code, you have the following:
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferId);


So, all pixel unpack operations source their values then from a PBO and not from a parameter, like in the "glTexImage2D" call that you do (which is a pixel unpack operation).

So either disable buffer objects for pixel unpack operations by doing:
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

or provide a null-parameter as the last argument for "glTexImage2D" in which case the data will be sourced from the currently bound PBO.

emzic

thank you for your help and your detailed explanation!

however, i dont do this glBindBuffer anywhere in my code. my app is basically just a hello-world app that should display a textured cube.

ok so i tried to do this:
ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, 0);
directly before the call to
glTexImage2D

and it still gives the same error.

thanks!

Kai

Quote
i tried this: GL11.glBindBufferARB(GL11.GL_PIXEL_UNPACK_BUFFER_ARB, 0);
but it doesnt find the first parameter.
It's ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, but as you said, you did not do anything with buffers, that effect sounds strange, then.

Kai

While google'ing around, I found someone apparently having the same problem:
http://slick.javaunlimited.net/viewtopic.php?p=10065

Are you using some kind of "framework", like slick or just real plain LWJGL (i.e. OpenGL)?

Somewhere in your code or in the "framework"'s code, PBO's must have been enabled.