javascript - how to get texture in webgl?without Canvas.toDataUrl() -


i want texture webgl can use getimagedata()when canvas context 2d.
how can texture form webgl context?

i know 3 possibilities. important! for these methods must set preservedrawingbuffer = true webgl.

to data url

first 1 high level method todataurl , origin javascript

canvas.todataurl(type, encoderoptions); 

you can use example if want allow client app "screenshot"

following 2 methods low level , origin webgl. can use them if want example modify texture or calculate new texture (shadows).

5.14.12 reading pixels

pixels in current framebuffer can read arraybufferview object.

void readpixels(glint x, glint y, glsizei width, glsizei height, glenum format, glenum type, arraybufferview? pixels)

5.14.8 texture objects

texture objects provide storage , state texturing operations ...

void teximage2d(glenum target, glint level, glenum internalformat, glint border, glenum format, glenum type, htmlcanvaselement element)


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -