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:

242 questions
0
votes
1 answer

Opengl VAO gets overwritten

I'm learning opengl and currently I'm struggeling with VAOs. I would like to draw a cube and a triangle using VAOs but unfortunately, only the object that I create later is drawn. This is what I do in the main loop: void main() { //loading shader,…
KO70
  • 189
  • 2
  • 15
0
votes
3 answers

OpenGL - Easiest way to draw a square with a texture

Usually I draw a square with a texture like this: Create a VBO with 4 coordinates (A,B,C,D for the square) Create a EBO with 4 indices (A,C,D and B,C,D) telling that I want to draw a square out of 2 triangles. Draw this elements with a…
waas1919
  • 2,365
  • 7
  • 44
  • 76
0
votes
1 answer

OpenGL Model/Texture rendering using VAO/VBO

I am trying to render 3D models with textures using Assimp. The conversion goes perfect, all textures positions and what not gets loaded. I have tested the texture images by drawing them to the screen in 2D. For some reason it does not render the…
0
votes
1 answer

OpenGL - Can't get shader to display vertex colors

So I finally set up opengl window properly and got triangles to show up using vaos, vbos and glDrawElements() etc. Here is the what i have But now I have new problem - can't get shaders to work. I don't quite understand them yet. I want fragment…
Splashman
  • 3
  • 1
0
votes
2 answers

When using IBO/EBO, program only works when I call glBindBuffer to bind the IBO/EBO AFTER creation of the VAO

For some reason, this program only works when I bind the IBO/EBO again, after I create the VAO. I read online, and multiple SO posts, that glBindBuffer only binds the current buffer, and that it does not attach it the the VAO. I thought the…
Greg M
  • 954
  • 1
  • 8
  • 20
0
votes
1 answer

How does OpenGL know to what position it should draw the vertices based on the GL_ARRAY_BUFFER?

For example, I have the following piece of code: //Create a vbo and bind it to the GL_ARRAY_BUFFER glGenBuffers(1, &positionBufferObject); glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject); //vertexPosition is an array of floats that stores…
Jeff
  • 833
  • 1
  • 8
  • 17
0
votes
1 answer

Apply color using VAO in jogl

I am trying to color my polygons in jogl. I have stored the vertices in an array, an index array for the triangle order and a color array. The code is as follows, but the problem that I am facing is that the triangle are white, and not the color…
zelta
  • 105
  • 2
  • 9
0
votes
2 answers

Draw cylinder lateral with glDrawElements, Index Buffer and enabled GL_CULL_FACE

I need this: And I HAVE TO use glDrawElements and this: glEnable(GL_CULL_FACE). What I tried: ... glm::vec3 CMyApp::GetCylinderUV(float u, float v) { u *= 2* 3.1415f; float r = 1; return glm::vec3(r * cosf(u), 2 * v, r *…
Zsolt Mester
  • 1,053
  • 9
  • 14
0
votes
1 answer

glDrawArrays cause out of memory

I am building a Qt application with OpenGL using VAO and VBOs. I got a simple reference grid that I want to draw with the following code void ReferenceGrid::initialize() { // Buffer allocation and initialization Float3Array vertices; for…
TheHube
  • 752
  • 1
  • 10
  • 23
0
votes
0 answers

OpenGL VAO always drawing first Vertex from origin

The title sums up my issue, but no matter what I set the first vertex as, OpenGL always draws it at the origin. I've tried this on a school computer and it wasn't a problem but I'm not at school and it's possible something I've changed is causing…
Bennet Leff
  • 376
  • 1
  • 4
  • 18
0
votes
1 answer

Why does this OpenGL code give no errors but print nothing to screen

To preface, I'm writing my OpenGL in D using Derelict. However, it should be almost the same as OpenGL with C++ as the function calls are identical. Regardless, I'm at a loss as to why my code will not print anything to the screen as my shader…
Bennet Leff
  • 376
  • 1
  • 4
  • 18
0
votes
1 answer

switch between vbo binded to one vao

Currently in my render function i use a VAO (Vertex Array Object) and four VBO (Vertex Buffer Object) binded with this VAO. for each VBO, I bind to the vao glGenVertexArrays (1, & vaoID [0]); // Create our Vertex Array Object glBindVertexArray…
Fabian Orue
  • 193
  • 2
  • 14
0
votes
1 answer

Opengl: first vertex always drawn at origin

I got the problem that the first vertex is always drawn at (0,0,0) no matter where I want it to be (all other positions are correct). I think it is a mistake in my 'init' function. Here are the positions I use: positions.push_back( glm::vec3(-0.5f…
TomS
  • 81
  • 1
  • 8
0
votes
1 answer

VAO and VBO Crashing when drawing

I changed my code from DisplayLists to VBOs / VAOs. But when i run the application it crashes. It crashes when at the first attempt to draw the VAOs. I'm drawing using no shaders (so it does not cause problems). There are up to 12 faces (12 * 3…
Geosearchef
  • 600
  • 1
  • 5
  • 22
0
votes
1 answer

OpenGL application crashes when VBO is not used

I am trying to draw objects without using VBO in OpenGL ES 2.0. My code tend to crash application from time to time (not always, even nothing is changed). The following is the code. I think the problem is that I only enable m_distLocation without…
M_global
  • 207
  • 4
  • 15