Jump to content

Vertex buffer object

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Omgchead (talk | contribs) at 18:12, 11 February 2008 (Created page with 'Are an OpenGL extension Vertex Buffer Objects (VBOs) that provide methods for uploading data ( vertex, normal vector, color, etc) to ...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Are an OpenGL extension Vertex Buffer Objects (VBOs) that provide methods for uploading data ( vertex, normal vector, color, etc) to the video device for non-immediate-mode rendering. VBOs offer substantial performance gains over immediate mode rendering primarily due to the fact that the data resides in the video device memory rather than the system memory and so it can be rendered directly by the video device.

The Vertex Buffer Object specification has been standardized by the OpenGL Architecture Review Board as of OpenGL Version 1.4. Similar functionality was available before the standardization of VBOs via the Nvidia-created extension Vertex Array Range[1].

Basic VBO functions

The following functions form the core of VBO access and manipulation[2]

GenBuffersARB(sizei n, uint *buffers)
Generates a new VBO and returns it's ID number as an unsigned integer. Id 0 is reserved.

BindBufferARB(enum target, uint buffer)
Use a previously created buffer as the active VBO.

BufferDataARB(enum target, sizeiptrARB size, const void *data, enum usage)
Upload data to the active VBO.

DeleteBuffersARB(sizei n, const uint *buffers)
Deletes the specified number of VBOs from the supplied array or VBO id.

Example usage in c99

unsigned int id;							       /* Create a variable to hold the VBO identifier */
float data[] = {1.0, 0.0, 1.0, 0.0, 0.0, -1.0, -1.0, 0.0, 1.0};		      /* Vertices of a triangle (counter-clockwise winding) */
glGenBuffersARB(1, &id);							     /* Create a new VBO and use the variable id to store the VBO id */
glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);					/* Make the new VBO active */
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(data), data, GL_STATIC_DRAW_ARB); /* Upload vertex data to the video device */

References

  1. ^ "GL_NV_vertex_array_range Whitepaper".
  2. ^ "OpenGL function reference".

Further Reading

Vertex Buffer Object Whitepaper