View Full Version : indexed vertex VBO and unindexed color VBO

03-26-2012, 02:07 PM
I have 1 vertex storing VBO that contains a large amount of vertex information, which is rendered from multiple separate index VBOs using glDrawElements. I do this in order to save memory. This worked fine without any sort of shading. However, I want to have pre-generated shading stored as colors in a VBO. This VBO has only the color information for the indexed vertices, none of the unindexed ones (to save memory). So, the vertices that should be drawn are indexed, but the colors are not. Is there any way to draw one VBO indexed and another not indexed for different attributes?

For those wondering, this is for a Minecraft-style volumetric renderer. I store every possible vertex in one VBO, and the chunks store index buffers that draw the visible vertices.

Any help would be appreciated!

03-26-2012, 09:13 PM
All streams have the same number of elements. The ony way I know around this is to replace the streams with textures and then use logic in the vertex shader to read different parts of each texture - definitely not for beginners.

03-27-2012, 06:50 PM
The work around you suggested works very well! I rendered the colors to a FBO (using GL_POINTS), and applied them in the vertex shader to the proper indexed vertex by using the gl_VertexID attribute. Thanks for the help!

03-27-2012, 11:53 PM
glad it worked - I haven't actually tried it myself just read about it