Questions tagged [vao]

Vertex Array Object (VAO) is an OpenGL Object that encapsulates all of the state needed to specify vertex data. They define the format of the vertex data as well as the sources for the vertex arrays.

A Vertex Array Object (VAO) is an OpenGL Object that encapsulates all of the state needed to specify vertex data (with one minor exception noted below). They define the format of the vertex data as well as the sources for the vertex arrays. Note that VAOs do not contain the arrays themselves; the arrays are stored in Buffer Objects (see below). The VAOs simply reference already existing buffer objects.

Resources:

225 questions
125
votes
4 answers

What are Vertex Array Objects?

I am just starting to learn OpenGL today from this tutorial: http://openglbook.com/the-book/ I got to chapter 2, where I draw a triangle, and I understand everything except VAOs (is this acronym OK?). The tutorial has this code:…
Patrick
  • 1,704
  • 3
  • 14
  • 17
80
votes
4 answers

OpenGL VAO best practices

Im facing an issue which I believe to be VAO-dependant, but Im not sure.. I am not sure about the correct usage of a VAO, what I used to do during GL initialization was a simple glGenVertexArrays(1,&vao) followed by a glBindVertexArray(vao) and…
user815129
  • 2,050
  • 1
  • 17
  • 29
42
votes
2 answers

Use of Vertex Array Objects and Vertex Buffer Objects

I am trying to understand these two, how to use them and how they are related. Let's say I want to create a simple terrain and a textured cube. For both objects I have the array of triangles vertices and for the cube I have an array containing the…
ali
  • 10,569
  • 20
  • 77
  • 128
17
votes
1 answer

OpenGL How Many VAOs

I am writing an OpenGL3+ application and have some confusion about the use of VAOs. Right now I just have one VAO, a normalised quad set around the origin. This single VAO contains 3 VBOs; one for positions, one for surface normals, and one…
lynks
  • 5,293
  • 6
  • 21
  • 42
9
votes
1 answer

How to draw with Vertex Array Objects and glDrawElements in PyOpenGL

I have the following code which should simply draw a green triangle to the screen. It is using Vertex Array Objects and index buffers to draw and has the simplest shader I could make. At first I was not using index buffers and was simply making the…
Milliams
  • 1,373
  • 1
  • 19
  • 29
7
votes
1 answer

How to get the currently bound Vertex Array Object?

How can I get the name of the currently bound Vertex Array Object? I looked in the manual but couldn't find an enum to use with glGet().
bwroga
  • 4,711
  • 2
  • 20
  • 25
6
votes
2 answers

How to use VAOs with instancing in Qt 5

I'm trying to wrap my head around how to use VAOs appropriately for instanced rendering (specifically in Qt 5.2, using OpenGL 3.3). My understanding is that VAOs save the state of the VBOs and associated attributes so that you don't need to worry…
rainbowgoblin
  • 1,131
  • 10
  • 23
5
votes
1 answer

Why does glValidateProgram fail when no VAO is bound?

I have a problem validating my shader program in LWJGL/OpenGL 3. I read the documentation, but I can't seem to find a reason why a VAO is needed when calling glValidateProgram. int program = glCreateProgram(); int vertexShader =…
5
votes
1 answer

OpenGL - glDrawElements vs Vertex Array Objects

I need help to see the trade-offs between them. It looks to me that glDrawElements() needs to get the index-data "live" as a parameter. On the other side if I use VAOs then during startup I buffer the data and the driver might decide to put it on…
ben
  • 452
  • 3
  • 10
5
votes
1 answer

Can OpenGL vertex buffer binding points be reused across different VAOs?

Suppose I set up two VAOs, using the new (as of OpenGL 4.3) glBindVertexBuffer mechanism: glGenVertexArrays(1, &vaoIndex0); glGenVertexArrays(1, &vaoIndex1); ... glBindVertexArray(vaoIndex0) glBindVertexBuffer(bindingIndex0,…
mjwach
  • 1,025
  • 2
  • 9
  • 19
5
votes
1 answer

OpenGL glBindBuffer(0) outside vao?

I currently do this to setup my vao: glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); ... glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); glBindVertexArray(0); My question is: do I need to bind null buffers to prevent my vbo and ibo to…
Benoît Dubreuil
  • 564
  • 7
  • 22
5
votes
2 answers

OpenGL Vertex Array/Buffer Objects

Question 1 Do vertex buffer objects created under a certain VAO deleted once that VAO is deleted? An example: glGenBuffers(1, &bufferObject); glGenVertexArrays(1, &VAO); glBindVertexArray(VAO); glBindBuffer(GL_ARRAY_BUFFER,…
sadanjon
  • 63
  • 1
  • 5
4
votes
2 answers

Android Vertex Array Objects?

I am writing some android code in preparation for a graphics intensive app I plan to develop. I haven't done any OpenGL since 2004. I stumbled across http://www.opengl.org/wiki/Vertex_Array_Object and multiple sources for the PC platform claim that…
Mikhail
  • 7,123
  • 9
  • 56
  • 121
4
votes
1 answer

How to create a grid in OpenGL and drawing it with lines

I need to create a grid like this: ---------------- | | | | | | ---------------- | | | | | | ---------------- | | | | | | ---------------- and rendering it just with lines. This is how I create the vertices and the…
thewoz
  • 415
  • 4
  • 18
4
votes
2 answers

How many VAOs and VBOs

As far as I understand it: A VAO represents a certain state. If I bind a VAO, add some VBOs and element buffers for indicies and stuff I can save a certain state of the object(s) I want to draw and activate and draw them easily later down the road…
user4063815
1
2 3
14 15