BufferTexture attribute size issue


I’m creating a BufferTexture with GL_RGBA32F internal format from a Vbo that has 8 float vertex attributes. Is this legal? I didn’t get a gl error, so I expect that it works and two pixels in the buffer texture will hold one Vbo entry. It seems to work on some gpu’s, but I get some strange results on others. Does anyone have experience with this?



You should be able to create a GL_RGBA32F BufferTexture from a VBO with no problem. The ClothSimulation sample shows this off (and might be a good test bed for trying on different GPUs):

Not sure about writing more than four vertex attributes into one BufferTexture though. I’ve never seen this and am guessing the answer is no. Can you just write these from multiple VBO’s into multiple BufferTextures (that is what the ClothSimulation sample does)?


Thanks Joel. I thought it was working because no gl error was returned.
I also read this in the specs:

    The command

      void TexBufferEXT(enum target, enum internalformat, uint buffer);

    is equivalent to

      TexBufferRangeEXT(target, internalformat, buffer, 0, size);

    with <size> set to the value of BUFFER_SIZE for <buffer>.


    The number of texels in the buffer texture's texel array is
    given by

      floor(<size> / (<components> * sizeof(<base_type>)),

    where <components> and <base_type> are the element count and base data
    type for elements...


But I will try to split the attributes to two Vbo’s and two BufferTextures then. Thanks.


I rewrote it with two Vbo’s and the results were the same, working on one gpu and not working on the other. It turned out that the issue was not the BufferTexture, but normalizing a zero length vector in glsl :blush:. So I think using a BufferTexture for more than 4 float attributes works well.