Texture Buffer Object shared with Vertex Buffer Ob

In reading the new OpenGL blubook Version 5, there is a section on Transform feedback which is based on using a Texture buffer object with data from a vertex buffer object. The code online does not exist so I went thru and coded this up myself. The book used

in vec3 positions; in the vertex shader and correspondingly I
set it with glVertexAttribPointer(index_Rcm, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); but when I glTexBuffer(GL_TEXTURE_BUFFER,GL_RGBA32F,attribute); I can never get this code to work.


in vec3 positions;
...
glVertexAttribPointer(index_Rcm, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); 
..
glTexBuffer(GL_TEXTURE_BUFFER,GL_RGBA32F,attribute);

If I replace everything with vec4 ie


in vec4 positions;
...
glVertexAttribPointer(index_Rcm, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); 
..
glTexBuffer(GL_TEXTURE_BUFFER,GL_RGBA32F,attribute);

it works as expected.

I then read deeper into glTexBuffer and took note of the table (for floats)

 	 	 	                                          Component
Sized  | Internal Format	|Base Type	Components|	Norm|	0	1	2	3
-----------------------------------------------------------------
GL_R32F            float                      1     NO  R 0 0 1
GL_RG32F           float                      2    YES  R G 0 1
GL_RGBA32F         float                      4     NO  R G B A

Does this mean that texture buffer objects can only alias a vertex buffer object with stride of 1,2,or 4 (ie stride of 3 not possible)?

3 components TBO were added in OpenGL 4.0

I believe this was added with ARB_texture_buffer_object_rgb32. Check and see if your implementation supports it. As randall mentioned, this was made core in OpenGL 4.0.

Thanks. Yes, GL_RGA32F is in the 4.0 implementation and ARB_texture_buffer_object_rgb32 solved the problem.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.