View Full Version : VBO Question: How many buffers?
I've got some vertex position data and color data. Both of these are stored as textures in an FBO (one texture for position and one texture for color). I'm using the FBO->PBO->VBO technique for render-to-vertex-array.
The question is, since I've got both position data and color data, do I need one VBO or two? In other words, do I need separate VBOs for position and color? Or do I need one single VBO with the positon data followed by the color data?
I've seen it both ways, but I can't find anything that says if one way is significantly better or faster.
Doh, I didn't realize there were multiple pages of search results for the search I did on this forum. I'm still reading through them, but will post them here as I find them:
Topic: Problem with VBOs (http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=2;t=017389#000005)
Originally posted by Relic:
While storing the data interleaved in a single buffer is a good idea, it's wrong that you must put all the data in one array buffer. Unfortunately the spec has no nice example but it's possible to put each attribute into a separate vertex buffer object. That's nice if you have some static and some dynamic data. Group them into separate buffer objects.
The BindBuffer call just select a buffer, only the gl*Pointer calls associate buffers with attributes. It looks like this:
VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0));
ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(0)); However, while this confirms that you can use either one or two buffers, it doesn't really say which way is better. Will keep looking...
Correct VBO Usage? (http://www.opengl.org/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic;f=5;t=000489#000003)
Originally posted by arekkusu:
I've only experimented with VBO's briefly, but from my understanding of the spec, creating separate buffers per attribute is perfectly valid. However you only want to do this in the case where you know that some attributes are static and some are dynamic, i.e. caching texture coords in VRAM while streaming positions and normals. If you've marked everything dynamic you're probably better off with one large buffer.This one says that one is better, but it doesn't really say why.
05-14-2007, 04:00 PM
Both approaches should provide the same performance. Of course, this may vary from card to card and from driver to driver but you can't do anything about it.
You should use the one you feel more comfortable with.
Thanks for your reply. In that case, I'll just go ahead and use two separate buffers, since I've got it working that way already.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.