# BufferTexture attribute size issue

**URL:** <https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688>\
**Category:** Using Cinder\
**Created:** [May 16, 2017, 2:55pm UTC](https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688 "2017-05-16T14:55:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [May 16, 2017, 2:55pm UTC](https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688/1 "2017-05-16T14:55:44Z")

</div>

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?

Thanks,  
-Gabor

---

<div class="post-metadata">

**Author:** ![joelpryde](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/joelpryde/32/347_2.png) [@joelpryde](https://discourse.libcinder.org/u/joelpryde)\
**Post date:** [May 17, 2017, 9:15pm UTC](https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688/2 "2017-05-17T21:15:22Z")

</div>

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):

> <https://github.com/cinder/Cinder/blob/master/samples/_opengl/ClothSimulation/src/ClothSimulationApp.cpp>

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)?

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [May 17, 2017, 9:46pm UTC](https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688/3 "2017-05-17T21:46:16Z")

</div>

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

```auto
    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...

```

([https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT\_texture\_buffer.txt](https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_buffer.txt))

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

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [May 18, 2017, 11:23am UTC](https://discourse.libcinder.org/t/buffertexture-attribute-size-issue/688/4 "2017-05-18T11:23:23Z")

</div>

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 😊. So I think using a BufferTexture for more than 4 float attributes works well.
