Reputation: 857
Is it possible to stream vertex data out of the vertex shader for use later? I've read that DirectX 11 is able to stream vertex data out whilst drawing so wondering if the latest OpenGL also supports something similar. I'd like to reuse the same vertex data between render passes rather than recreating the same skinned vertex data each time, is this something that a compute shader would be better suited for?
Upvotes: 3
Views: 306
Reputation: 1326
Transformation feedback
From the wiki page:
Transform Feedback is the process of capturing Primitives generated by the Vertex Processing step(s), recording data from those primitives into Buffer Objects
You can then draw that data again later. You can use this to avoid re-skinning and re-tessellating meshes.
The wiki page covers enough ground to get you started.
For a comprehensive overview you need to look at the specification.
The tutorials available are decent (Those I've looked at, at least) and with a bit of googling their easy to find.
Upvotes: 1
Reputation: 2480
You need 2 threads, one for drawing and the other for "streaming" vertex data to your GPU.
For this to work, you need to have two OpenGL contexts - http://www.equalizergraphics.com/documentation/parallelOpenGLFAQ.html
More: Multithreaded Rendering on OpenGL
This one is from iOS OpenGL ES docs, but the concept is similar: https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ConcurrencyandOpenGLES/ConcurrencyandOpenGLES.html#//apple_ref/doc/uid/TP40008793-CH409-SW2
Looks like you're looking for VBO's:
A Vertex Buffer Object (VBO) is a Buffer Object which is used as the source for vertex array data. It is no different from any other buffer object, and a buffer object used for Transform Feedback or asynchronous pixel transfers can be used as source values for vertex arrays.
Upvotes: 0