Graphics Reference
In-Depth Information
This assignment is implementation specific; that is, it can vary from one
OpenGL ES 3.0 implementation to another. An application can query the
assigned binding by using the glGetAttribLocation command.
GLint glGetAttribLocation (GLuint program ,
const GLchar * name )
program
program object
name
name of attribute variable
glGetAttribLocation returns the generic attribute index that was
bound to the attribute variable name when the program object defined by
program was last linked. If name is not an active attribute variable, or if
program is not a valid program object or was not linked successfully, then
-1 is returned, indicating an invalid attribute index.
Vertex Buffer Objects
The vertex data specified using vertex arrays are stored in client memory.
This data must be copied from client memory to graphics memory when
a draw call such as glDrawArrays or glDrawElements is made. These
two commands are described in detail in Chapter 7, “Primitive Assembly
and Rasterization.” It would, however, be much better if we did not have
to copy the vertex data on every draw call, but instead could cache the
data in graphics memory. This approach can significantly improve the
rendering performance and also reduce the memory bandwidth and
power consumption requirements, both of which are quite important
for handheld devices. This is where vertex buffer objects can help. Vertex
buffer objects allow OpenGL ES 3.0 applications to allocate and cache
vertex data in high-performance graphics memory and render from this
memory, thereby avoiding resending data every time a primitive is drawn.
Not only the vertex data, but also the element indices that describe
the vertex indices of the primitive and are passed as an argument to
glDrawElements , can be cached.
OpenGL ES 3.0 supports two types of buffer objects that are used for
specifying vertex and primitive data: array buffer objects and element array
buffer objects . The array buffer objects specified by the GL_ARRAY_BUFFER
token are used to create buffer objects that will store vertex data. The
element array buffer objects specified by the GL_ELEMENT_ARRAY_BUFFER
 
 
 
Search WWH ::




Custom Search