Скачиваний:
47
Добавлен:
17.03.2015
Размер:
2.46 Mб
Скачать

2.10. RECTANGLES

39

2.9.2 Array Indices in Buffer Objects

Blocks of array indices may be stored in buffer objects with the same format options that are supported for client-side index arrays. Initially zero is bound to

ELEMENT ARRAY BUFFER, indicating that DrawElements and DrawRangeElements are to source their indices from arrays passed as their indices parameters, and that MultiDrawElements is to source its indices from the array of pointers to arrays passed in as its indices parameter.

A buffer object is bound to ELEMENT ARRAY BUFFER by calling BindBuffer with target set to ELEMENT ARRAY BUFFER, and buffer set to the name of the buffer object. If no corresponding buffer object exists, one is initialized as defined in section 2.9.

The commands BufferData, BufferSubData, MapBuffer, and UnmapBuffer may all be used with target set to ELEMENT ARRAY BUFFER. In such event, these commands operate in the same fashion as described in section 2.9, but on the buffer currently bound to the ELEMENT ARRAY BUFFER target.

While a non-zero buffer object name is bound to ELEMENT ARRAY BUFFER, DrawElements and DrawRangeElements source their indices from that buffer object, using their indices parameters as offsets into the buffer object in the same fashion as described in section 2.9.1. MultiDrawElements also sources its indices from that buffer object, using its indices parameter as a pointer to an array of pointers that represent offsets into the buffer object.

Buffer objects created by binding an unused name to ARRAY BUFFER and to ELEMENT ARRAY BUFFER are formally equivalent, but the GL may make different choices about storage implementation based on the initial binding. In some cases performance will be optimized by storing indices and array data in separate buffer objects, and by creating those buffer objects with the corresponding binding points.

2.10Rectangles

There is a set of GL commands to support efficient specification of rectangles as two corner vertices.

void Rect{sifd}( T x1, T y1, T x2, T y2 ); void Rect{sifd}v( T v1[2], T v2[2] );

Each command takes either four arguments organized as two consecutive pairs of (x, y) coordinates, or two pointers to arrays each of which contains an x value followed by a y value. The effect of the Rect command

Rect (x1, y1, x2, y2);

Version 2.0 - October 22, 2004

Соседние файлы в папке OpenGL