Hi all,
I need to attach a texture buffer object to a VBO to give a readonly view of the VBO. My vertex shader generates the new positions which are correctly stored in the vbo however the TBO contains the same init values. I setup the vbos/tbo pair as follows,
//init
glBindVertexArray(vaoID);
glBindBuffer( GL_ARRAY_BUFFER, vboID_Pos);
glBindBuffer( GL_TEXTURE_BUFFER, tboID);
glBufferData( GL_ARRAY_BUFFER, sizeof(position_mass_data), &(position_mass_data[0]), GL_DYNAMIC_DRAW);
glBufferData( GL_TEXTURE_BUFFER, sizeof(position_mass_data), &(position_mass_data[0]), GL_DYNAMIC_DRAW);
glBindTexture( GL_TEXTURE_BUFFER, texID);
glTexBuffer( GL_TEXTURE_BUFFER, GL_RGBA32F_ARB, tboID);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
//render
glBindVertexArray( vaoID);
glActiveTexture( GL_TEXTURE0);
glBindTexture( GL_TEXTURE_BUFFER, texID);
glDrawArrays(GL_POINTS, 0, MAX_MASSES);
glBindVertexArray( 0);
Is this the correct way to setup TBO with VBO such that the TBO shares the data with the VBO? Note that there are no OGL errors. I have used gDebugger to see the vbo contents and it lists the init data in the TBO where as the vbo data is correctly updated. Any ideas where I am wrong?
Regards,
Mobeen