Preparation ◼ Prepare array of vertex (typically by class/struct). ◼ Allocate vertex/index buffer* on GPU. ◼ Bind (= enable) vertex/index buffers. ◼ Transfer data from CPU to GPU. *index buffer = store vertex indices to define triangles ◼ Drawing ◼ Bind (= enable) vertex buffer. ◼ Specify data types in vertex buffer. ◼ Draw triangles using index buffer. ◼ Cleanup
Introduced in OpenGL 3.0 (published in 2008) ◼ It can internally manage VBOs, IBOs, and other settings for buffers. ◼ Just by enabling/disabling VAO, all the settings are also enabled/disabled. Computer Graphics Course @Waseda University
VAO. ◼ Setup for VBO, IBO and others. ◼ Disable VAO. ◼ Drawing ◼ Enable VAO ◼ Draw primitives using index buffer. ◼ Disable VAO Computer Graphics Course @Waseda University → Drawing gets significantly simpler only by slightly more preparation!
or newer ◼ Current Windows PC supports that ☺ ◼ MacOS generally uses OpenGL 2.1 and it needs a rather complicated workaround Computer Graphics Course @Waseda University
VBO/IBO can be combined with VAO ◼ glVertexPointer is a function in OpenGL 2.x (it’s deprecated in latest OpenGL). ◼ Deprecated functions are supported by “compatibility profile” of OpenGL (which can be used in Windows, but not in Mac). ◼ For Mac, all the source code must be rewritten to follow OpenGL 3.x specification. ◼ Mac only supports “core profile” which does not have backward compatibility. ◼ OpenGL 3.x core profile requires shader-based drawing. ◼ So, you must use shader programs! (see next section “9. Shader language”) Computer Graphics Course @Waseda University