Blitting it to where? You can use SDL to create a surface, which will be backed by a canvas (but it still does a copy to blit from C++ memory to an HTML canvas buffer). Or for GL, you would just upload the C++ data to a GL texture normally.
- Alon On Tue, Jun 3, 2014 at 5:14 AM, ben layet <[email protected]> wrote: > Yes you're correct, by "get" I mean download by http. In my use case the > advantage of moving the download into the NaCl C++ code was that I could > decode into an image buffer that is then handed over (not copied) to the > NaCl 2D drawing API. (And the NaCl runtime seems to recycle these buffers > efficiently - so that you get one back later when you create a new image > buffer of the same size.) > > In Emscripten, it sounds like I could use async_wget for download. What > APIs are available in Emscripten for blitting the image? I presume they are > implemented using HTML 5 features such as the canvas or webgl? > > thanks > ben > > On Thursday, 29 May 2014 18:35:03 UTC+1, Alon Zakai wrote: > >> By "get" do you mean download using http? There are some utilities for >> that (see emscripten.h, async_wget) but on the web all such network >> accesses require a copy, since they return a new buffer with the data - it >> can't be directly stored into a region of an existing typed array. >> >> - Alon >> >> >> >> On Thu, May 29, 2014 at 1:19 AM, ben layet <[email protected]> wrote: >> >>> Thanks for feedback, confirms what I thought... >>> >>> I met the same issue with Google Native Client actually. In that case I >>> ended up doing the image get in the C++ too, and rendering using the >>> pp::Graphics2D API. When using pp::Graphics2D::ReplaceContents it >>> seemed that the browser was smart about reusing buffers (as documented). >>> Conceivably, moving these operations into the C++ might make more sense >>> with emscripten too - I'm not sure what APIs are available to the C++. >>> >>> ben >>> >>> -- >>> 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]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- 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]. For more options, visit https://groups.google.com/d/optout.
