Dear Experts,
Has anyone tried to use OpenGL transform feedback in Emscripten?
In case you are unfamiliar, transform feedback is a way of
storing the output of a vertex shader into a buffer. This is
useful for a couple of purposes: you can store updated vertex
data and feed that back into the vertex shader for the next
frame (e.g. particle systems), or you can get something like
a compute shader by disabling rasterisation and reading the
transform feedback output buffer's data to the CPU. I'm trying
to do the latter.
I've got something that basically works but I'm unsure how
best to read the results from the transform feedback output
buffer.
I believe OpenGL ES has only glMapBufferRange; WebGL2 has only
getBufferSubData. Emscripten provides glMapBufferRange when
FULL_ES3 is enabled, but that seems only to be for writing to
the buffer, not for reading from it. Currently I have a bit
of EM_JS to wrap getBufferSubData - is this the best solution?:
EM_JS(void, getBufferSubData, (intptr_t addr, size_t length), {
// must length be scaled, as well as addr?
GLctx.getBufferSubData(GLctx.TRANSFORM_FEEDBACK_BUFFER, 0, HEAPF32,
addr >> 2, length);
});
Thanks, Phil.
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/1614963871702%40dmwebmail.dmwebmail.chezphil.org.