Hello there.
I am just wondering if it isn’t trivially possible to implement functionality to scatter an output vertex to some arbitrary position into a transform feedback bound buffer via a vertex shader for OpenGL 3 Core?!
I use TF currently like this:
// Single vertex shader with transform feedback, pseudo:
in in_vert ;
out out_vert ;
void main()
{
// maps input_buffer[gl_VertexID] -> output_buffer[gl_VertexID]
out_vert = in_vert ;
}
This means, I map input vertices with gl_VertexID to the output buffer where that vertex is placed on index gl_VertexID.
That just works fine.
Now the question is, wouldn’t it be possible to do something like this
// Single vertex shader with transform feedback, pseudo:
in in_vert ;
out out_vert ;
int f( int id ){... do some mapping... }
void main()
{
// default: gl_VertexIDOut = gl_VertexID
gl_VertexIDOut = f(gl_VertexID) ;
// maps input_buffer[gl_VertexID] -> output_buffer[gl_VertexIDOut]
out_vert = in_vert ;
}
So that the currently processed vertex does not go to position gl_VertexID but to position gl_VertexIDOut.
That would also be coincident with gl_PrimitiveIDIn and gl_PrimitiveID.
I use texture buffers a lot and there would be tons of applications which could use that functionality because those application are not requiring the rasterizer nor any fragment shader invocation.
If such thing would be possible, that would be GPGPU like hell or maybe totally like :doh:
So long.