glGenBuffers is not supposed to create the buffer

Started by mikage, December 11, 2009, 15:59:42

Previous topic - Next topic

mikage

It seems to me that the method glGenBuffers of LWJGL does more than it should do. According to the OpenGL spec, this method should return valid buffer ids without associating them to a buffer object. This is best explained in the definition of glIsBuffer :

http://www.opengl.org/sdk/docs/man/xhtml/glIsBuffer.xml

Yet, this sample code returns true :

int bufferId;
IntBuffer intBuffer = IntBuffer.allocate(1);
GL15.glGenBuffers(intBuffer);
bufferId = intBuffer.get(0);
System.out.print(GL15.glIsBuffer(bufferId));


Can someone please explain if I'm wrong here ?

Thanks
mikage

Kai

This seems to be no bug in LWJGL.

I tested this with a simple C/GLEW-example and it gave me the exact same results that you get with LWJGL.

Besides, LWJGL really does not do anything else than forwarding the call to the C library :-)

delt0r

You are misunderstanding what the return number is.

Its a handle to a buffer as a int. The isBuffer just checks to see if this handle is a buffer handle. No data is yet associated with it.
If you want a plot read a book and leave Hollywood out of it.

Kai

QuoteYou are misunderstanding what the return number is.
I don't think that mikage is misunderstanding the meaning of that method.

As stated by the spec:
QuoteA name returned by glGenBuffers, but not yet associated with a buffer object by calling glBindBuffer, is not the name of a buffer object.
a name returned by glGenBuffers should not return TRUE for glIsBuffer.

So, I guess that the OpenGL implementation in the driver is wrong, at this part.

delt0r

indeed Kai, you are correct. It seems perhaps the driver author had a similar misunderstanding...
If you want a plot read a book and leave Hollywood out of it.

mikage

So it seems to be a driver problem then. Thanks for the help  :).
(for info  I'm testing this on an NVidia 8400GS with the Nvidia 177.82 driver in Ubuntu 8.10.)