PDA

View Full Version : Vertex Arrays still useful?



Fsq.cpp
12-21-2013, 06:33 PM
Hi all
I've just learned OpenGL for nearly two months on my own and my guidebook is <OpenGL Programming Guide seventh edition>(based on OpenGL 3.0&3.1). where Vertex Arrays are mentioned. But in some other newly published textbooks there is not a single word about Vertex Arrays?! How come? Is Vertex Arrays not useful any more? Or OpenGL4 has abandoned Vertex Arrays?

THX!

chbaker0
12-21-2013, 08:28 PM
By no means have they been abandoned. In fact, they are REQUIRED in core profiles in OpenGL 3.2+. That's odd that they aren't mentioned, perhaps they just never really put a name to it in the book.

More info about them here (http://www.opengl.org/wiki/Vertex_Specification#Vertex_Array_Object)

Dark Photon
12-22-2013, 12:50 PM
Right. Vertex arrays are core to the OpenGL implementation. Tutorial books aside, the key thing is what the GL Spec (http://www.opengl.org/registry/doc/glspec44.compatibility.pdf) says, and it clearly describes vertex arrays. They contain arrays of data values used to populate vertex attributes on the GPU.

Vertex arrays can be stored in:


server-side memory (i.e. GL driver-side memory) in vertex buffer objects (VBOs), or
client-side memory (i.e. your application's memory) in what's termed client arrays.

The former is the more modern approach, while the latter is "the way it used to be done" (which is obsoleted in OpenGL "core" profiles, but still available in OpenGL "compatibility profiles).

So I suspect for any modern GL book that doesn't explicitly mention vertex arrays, it clearly talks about vertex buffer objects. Just keep in mind these are just server-side containers for vertex arrays and the element (index) arrays.

mhagain
12-23-2013, 02:28 PM
So I suspect for any modern GL book that doesn't explicitly mention vertex arrays, it clearly talks about vertex buffer objects. Just keep in mind these are just server-side containers for vertex arrays and the element (index) arrays.

I'd add to this is that another reason why is because there is no other way of drawing.

With old OpenGL there were multiple ways of drawing: immediate mode, display lists, vertex arrays, vertex arrays with VBOs, and a few weird mixed cases (such as immediate-mode-indexing via glBegin/glArrayElement/glEnd), so it made sense to call out vertex arrays explicitly.

With modern OpenGL there is only one way of drawing - vertex arrays with VBOs - so it no longer makes the same kind of sense. But when you read material on modern OpenGL you should always understand that it's using vertex arrays with VBOs, even when it doesn't explicitly say so.

Osbios
12-23-2013, 08:21 PM
vertex arrays are basically like vertex buffer objects used with GL_STREAM_DRAW_ARB as usage hint.

not vertex array objects but vertex buffer objects, hope I didn't confuse anyone