Texture Buffer Object, how it works?

I try to use GL_EXT_texture_buffer_object but I can’t figure out how it is supose to work… I’m kind of surprise by this extension spectication, it doesn’t seam completed and all the GLSL part of it is written in the GL_EXT_gpu_shader4 extensions… Well maybe.

I think to access to data save in a texture buffer object we have to use in GLSL this:
uniform samplerBuffer MySamplerBuffer;
and this
int Index = …
vec4 Displacement = texelFetchBuffer(MySamplerBuffer, Index);

But: What if the format of the texture buffer is GL_ALPHA? It is even possible?

On the C++ side my understanding is unfortunatly worse.
This is what I have written to create this texture buffer:

glGenBuffers(1, &bufferObject);
glBindBuffer(GL_TEXTURE_BUFFER_EXT, bufferObject);
glBufferData(GL_TEXTURE_BUFFER_EXT, sizeof(Array), Array, GL_STATIC_DRAW);

This should have create my buffer object. I’m not sure it is good but I haven’t any error. Then I create a texture object like that:

glGenTextures(1, &textureObject);
glBindTexture(GL_TEXTURE_BUFFER_EXT, _textureObject);
glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA, bufferObject);

However I have an error on “glTexBufferEXT” call…
Any idea?


Fine… thank to an error I just saw this message:
(6) : warning C7508: extension GL_EXT_texture_buffer_object not supported

I tryed it on both vertex and fragment shaders…
I have a GeForce 8600GT but this extension is perfectly load but GLEW and listed in my extension list…

Well, funny isn’t it?

Drivers: 169.09 on WinXP 64

I might be have made an error… I hope so…

glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA32F_ARB, bufferObject);

And problem resolved!

It’s interesting that the GLSL compiler output is still this:
(5) : warning C7508: extension GL_EXT_texture_buffer_object not supported

Even it works perfectly

I finally understand that GLSL things from GL_EXT_texture_buffer_object extension are defined in GL_EXT_gpu_shader4 so we haven’t to defined it to use TBO. GL_EXT_gpu_shader4 is enough.

You seem to be good at both having a problem and finding its solution :
I think you should write some FAQ pages on the OpenGL wiki :slight_smile: