Rajveer
Rajveer

Reputation: 857

OpenGL 4.4/ES 3.0 and caching vertex data between passes

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

Answers (2)

Xonar
Xonar

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

Dannie
Dannie

Reputation: 2480

"I've read that DirectX 11 is able to stream vertex data out whilst drawing"

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

"I'd like to reuse the same vertex data between render passes rather than recreating"

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

Related Questions