On Fri, Mar 5, 2021 at 9:04 AM 'Phil Endecott' via emscripten-discuss <
[email protected]> wrote:

> 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);
> });
>
>
I'm not a webgl expert but it looks like something that could/should be
added to  library_webgl2.js.

Maybe could even just be added to the list of pass through functions at the
end?

cheers,
sam


> 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
> .
>

-- 
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/CAL_va29mMr-g0JHTdtRpgACdztJ7UVkyFrKv6kGG26sitB480Q%40mail.gmail.com.

Reply via email to