Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: indexed vertex VBO and unindexed color VBO

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114

    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!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    723

    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.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2012
    Posts
    114

    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!

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    723

    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
  •