PDA

View Full Version : Texture Buffer Object, how it works?



Groovounet
11-24-2007, 07:14 PM
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?

Thank

Groovounet
11-26-2007, 04:10 PM
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...

Groovounet
11-26-2007, 04:23 PM
glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA32F_ARB, bufferObject);

And problem resolved!

Groovounet
11-26-2007, 07:18 PM
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

Groovounet
11-27-2007, 06:52 PM
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.

ZbuffeR
11-28-2007, 02:45 AM
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 (http://www.opengl.org/wiki) :)