PDA

View Full Version : Zero-values in TBO



Tom Vonzet
10-06-2011, 09:17 AM
Hello everyone.
I'm trying to begin to use EXT_texture_buffer_object.

Here is my code:



...
glGenBuffers(4, KFFs[i]->VBObuffers);
glBindBuffer(GL_TEXTURE_BUFFER_EXT, KFFs[i]->VBObuffers[0]);
glBufferData(GL_TEXTURE_BUFFER_EXT, KeyFrames[i].Count[3]*9*sizeof(float), &(KeyFrames[i].SynVertices[0]), GL_STREAM_DRAW_ARB); //the buffer is ok, i've tryed to draw it as a VertexPointer.
...

glGenTextures(1, &KFFs[i]->textureId);
glBindTexture(GL_TEXTURE_BUFFER_EXT, KFFs[i]->textureId);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGB32F_ARB, KFFs[i]->VBObuffers[0]);

glBindBufferARB(GL_TEXTURE_BUFFER_EXT, 0);
glBindTexture(GL_TEXTURE_BUFFER_EXT, 0);

...

//Before drawing
glActiveTextureARB ( GL_TEXTURE0_ARB );
glBindTexture ( GL_TEXTURE_2D, uiTexture ); //real texture
glActiveTextureARB ( GL_TEXTURE1_ARB );
glBindTexture ( GL_TEXTURE_BUFFER_EXT, KFFs[NextKeyFrame]->textureId); //TBO
...


vertex shader:


#extension GL_EXT_gpu_shader4:enable

uniform samplerBuffer texBuf;


void main(void)
{
vec4 instData = texelFetchBuffer(texBuf, gl_VertexID);
gl_Position = gl_ModelViewProjectionMatrix * (instData);

//...
}


Well, unfortunately instData is always 0.
Please help, where could be a mistake, where to look for it?

P.S. NVidia gts250.

malexander
10-06-2011, 10:29 AM
This is likely because your Nvidia GTS250 does not support the GL_ARB_texture_buffer_object_rgb32 extension. Try using a RGBA packing for your buffer object instead, even if you have to pad alpha.