-
Junior Member
Regular Contributor
indexed vertex VBO and unindexed color VBO
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!
-
Advanced Member
Frequent Contributor
Re: indexed vertex VBO and unindexed color VBO
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.
-
Junior Member
Regular Contributor
Re: indexed vertex VBO and unindexed color VBO
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!
-
Advanced Member
Frequent Contributor
Re: indexed vertex VBO and unindexed color VBO
glad it worked - I haven't actually tried it myself just read about it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules