PDA

View Full Version : glBufferSubData for other buffer targets



Groovounet
04-30-2008, 10:37 AM
Hi!

Page 36 in OpenGL 2.1 specification speak about glBufferSubData:

"
To modify some or all of the data contained in a buffer objectís data store, the
client may use the command
void BufferSubData( enum target, intptr offset,
sizeiptr size, const void *data );
with target set to ARRAY_BUFFER
"

However I can't understand why we must use "ARRAY_BUFFER" as the value of the "target" parameter. Why not ELEMENT_ARRAY_BUFFER to update an element buffer ?

It's like we have to change the binding point of the buffer to array buffer because this binding point have a "special feature"... I can't imagine a reason...

After a try, we actually can't update an element buffer from the ELEMENT_ARRAY_BUFFER binding point. (With a GeForce 8800)

Thank!

Relic
04-30-2008, 05:03 PM
That's either an oversight or a conscious decision.
Sounds weird that GetBufferSubData accepts ELEMENT_ARRAY_BUFFER as target in the OpenGL 2.1 spec, but not BufferSubData.

The ARB_vertex_buffer_object spec had that.



New Tokens

Accepted by the <target> parameters of BindBufferARB, BufferDataARB,
BufferSubDataARB, MapBufferARB, UnmapBufferARB,
GetBufferSubDataARB, GetBufferParameterivARB, and
GetBufferPointervARB:

ARRAY_BUFFER_ARB 0x8892
ELEMENT_ARRAY_BUFFER_ARB 0x8893

...
The commands BufferDataARB, BufferSubDataARB, MapBufferARB, and
UnmapBufferARB may all be used with <target> set to
ELEMENT_ARRAY_BUFFER_ARB. In such event, these commands operate in
the same fashion as described in section 2.8A, but on the buffer
currently bound to the ELEMENT_ARRAY_BUFFER_ARB target."