Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

From what I've read, it seems VBOs are purely for performance.

I'm working on a very rudimentary learning project in lwjgl and I'm just trying to figure out what more advanced features of the library I should be delving into, and what their use is.

My understanding is that VBOs allow a person to keep vertexes in VRAM while they aren't currently being drawn in a scene. In my case, I'm just drawing quads and performance probably isn't a concern at all, but I'm trying to piece together what's happening under the hood. If I'm drawing quads directly, I'm drawing from the CPU memory, correct? Also, if I'm not doing any checks for visibility, does that mean I'm rendering absolutely everything in the "scene", regardless of whether its in view? Are VBOs a way to store objects and only render what's needed?

share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

Pedantic note: There is no such thing in OpenGL as a "Vertex Buffer Object." There are simply Buffer Objects. A buffer object is simply a linear array of GPU memory that you can allocate, fill with data, read from, and use in a variety of ways. One of the things you can do with buffer objects is store vertex data in them and use them as source arrays for rendering. But they have quite a few other uses as well.

Buffer objects are not a way to avoid frustum culling or other scene-graph-style constructs. When used for vertex data, buffer objects simply store vertex data. Without them, your glDrawElements/Arrays/etc calls will pull data from arrays stored in CPU member buffers. When using buffer objects for rendering, the arrays are pulled instead from buffer object contents.

Where your vertex data comes from is the only difference between rendering with buffer objects and rendering without them. So no frustum culling. No scene-graph management. Nothing. It's just about where your vertex data is stored.

share|improve this answer
1  
I might clarify just a bit and mention that the real optimization you make by using VBO's relates to the bus between the CPU and GPU, which is relatively slow (and contentious). If this bus speed were negligible, there would be virtually no difference between using a VBO and using a CPU-side array of floats. –  stephelton Nov 27 '11 at 8:46
1  
Also worth noting that your driver is free to store buffer objects wherever it wants, including in CPU memory. –  Jimmy Shelter Nov 27 '11 at 12:50
    
Aside from that, building a VBO/VAO and just calling drawarrays on that is (imho) easier than having to loop fixed pipeline functions for all vertices/faces. It's like telling the graphics card "go run this box of triangles through that shader" instead of "Go take that vertex, that vertex and that, and make a nice happy little triangle over there. Now take the next...". Oh, wait, now I'm getting into shaders more then VBOs. –  sarahm Nov 27 '11 at 19:26
add comment

OpenGL array buffers (= what we call VBO) serve one single purpose: Keep your geometry data inside GPU memory not client memory, so that you won't need to re-send it every frame.

As simple as that :-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.