23.06.2013 Views

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.9. BUFFER OBJECTS 36<br />

Name Value<br />

BUFFER SIZE size<br />

BUFFER USAGE usage<br />

BUFFER ACCESS READ WRITE<br />

BUFFER MAPPED FALSE<br />

BUFFER MAP POINTER NULL<br />

Table 2.7: Buffer object initial state.<br />

Clients must align data elements consistent with the requirements of the client<br />

platform, with an additional base-level requirement that an offset within a buffer to<br />

a datum comprising N basic machine units be a multiple of N.<br />

If the GL is unable to create a data store of the requested size, the error<br />

OUT OF MEMORY is generated.<br />

To modify some or all of the data contained in a buffer object’s data store, the<br />

client may use the command<br />

void BufferSubData( enum target, intptr offset,<br />

sizeiptr size, const void *data );<br />

with target set to ARRAY BUFFER. offset and size indicate the range of data in the<br />

buffer object that is to be replaced, in terms of basic machine units. data specifies a<br />

region of client memory size basic machine units in length, containing the data that<br />

replace the specified buffer range. An INVALID VALUE error is generated if offset<br />

or size is less than zero, or if offset + size is greater than the value of BUFFER SIZE.<br />

<strong>The</strong> entire data store of a buffer object can be mapped into the client’s address<br />

space by calling<br />

void *MapBuffer( enum target, enum access );<br />

with target set to ARRAY BUFFER. If the GL is able to map the buffer object’s<br />

data store into the client’s address space, MapBuffer returns the pointer value<br />

to the data store. If the buffer data store is already in the mapped state, Map-<br />

Buffer returns NULL, and an INVALID OPERATION error is generated. Otherwise<br />

MapBuffer returns NULL, and the error OUT OF MEMORY is generated. access is<br />

specified as one of READ ONLY, WRITE ONLY, or READ WRITE, indicating the operations<br />

that the client may perform on the data store through the pointer while the<br />

data store is mapped.<br />

MapBuffer sets buffer object state values as shown in table 2.8.<br />

Version 2.0 - October 22, 2004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!