[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] Specifying source rectangle in texImage2D and texSubImage2D overloads with HTML elements

(apologies for possible multiple copies)


According to the specifications (well, actually inferring it from the
API), the overload versions of texImage2D and texSubImage2D taking an
HTMLElement (canvas/image/video) extract the image/subimage dimensions
from the element itself.
It would be useful if a source subrectangle (both origin and
dimensions) could be specified, more or less as the ArrayBufferView
overloads do.

I know there are several ways to accomplish this, like rendering the
subrect on a canvas and read it back (with ImageData maybe...), or
creating a full-sized intermediate texture to be used as source and
then manually render the subrect to another texture, or whatever else.
Anyway, these methods involve an unnecessary copy.

Am I unaware of some JS API that extract an ImageData subrect from
images/videos without passing through a canvas (even if, to my
intuition, this is also sub-optimal) ?
I could understand that compression issues may force the decompression
of the whole image/frame before extracting a subrect, but still,
native code doing this would perform better.

Or is there already something to do this "ideal" subrect transfer
(shame on me, I didn't found it) ?


Marco Di Benedetto, Ph.D.

Researcher at the Visual Computing Lab
Istituto di Scienza e Technologie dell'Informazione "A. Faedo" (ISTI)
Consiglio Nazionale delle Ricerche (CNR) - Pisa - Italy
Office Phone: +39 050 315 2921
E-Mail: marco.dibenedetto@isti.cnr.it - spattija@gmail.com

You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl