[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Loading WebGLBuffer from an HTMLImageElement
- To: Glenn Maynard <glenn@zewt.org>
- Subject: Re: [Public WebGL] Loading WebGLBuffer from an HTMLImageElement
- From: Kenneth Russell <kbr@google.com>
- Date: Tue, 12 Apr 2011 10:48:59 -0700
- Cc: Vladimir Vukicevic <vladimir@pobox.com>, public webgl <public_webgl@khronos.org>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1302630542; bh=GsraWB3mI2sGl8OY1HMAQrbtV5I=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Cc:Content-Type:Content-Transfer-Encoding; b=vAmWc3Jem5eyzrWxTBiBJBQ+xnffu+4rJrtM0w5rJn/qbUxDkM19gGpYu/fBuPszK FW8OhvWgofvrYZi1lZDkw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=JScA4UAlIzp+G5mpregFbGG6fQNf3CNzlS3Quwr1CYA=; b=MoJs4ihvqM88kJ/NvjkPOZ1PVlz24PeEp/Ht1yxj+ILAC1OryTfynK7S2iY0mYFNz+ oWlqIpFtLw41YAH1TVbw==
- Domainkey-signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LqNviwk8PaSMjDtaflrI6kbztKnDSsTRFPfGwD9XcvYntBTqm117VAzDacb2vwkrUn 2EYD7ZTZp/StuOmFAm/g==
- In-reply-to: <BANLkTi=kkOo52rdy3DbunUj4fwhGpfCbCQ@mail.gmail.com>
- List-id: Public WebGL Mailing List <public_webgl.khronos.org>
- References: <BANLkTin6ccTxymfsiNb4+rVfPbE4LwJtuA@mail.gmail.com> <27541974.13727.1302597940588.JavaMail.root@zimbra.off.net> <BANLkTi=kkOo52rdy3DbunUj4fwhGpfCbCQ@mail.gmail.com>
- Sender: owner-public_webgl@khronos.org
On Tue, Apr 12, 2011 at 9:00 AM, Glenn Maynard <glenn@zewt.org> wrote:
>
> On Tue, Apr 12, 2011 at 4:45 AM, Vladimir Vukicevic <vladimir@pobox.com> wrote:
>> It's a bit roundabout, but you can:
>>
>> - Load the image as an image
>> - Draw it into an offscreen 2D <canvas> of the same size
>> - Use getImageData
>> - Use the returned ImageData's data buffer with buffer[Sub]Data
>>
>> Requires an extra step with the canvas drawing (and associated extra memory usage), but should be possible.
>
>> ----- Original Message -----
>>> It currently doesn't appear possible to load a WebGLBuffer from an
>>> image, to use an image as vertex data. I can't do this manually, by
>>> writing the image to a 2d Canvas and passing its ImageData to
>>> bufferData, due to same-origin restrictions.
>
> That's what I described here: it doesn't work, since getImageData
> isn't allowed for cross-origin images. A direct API can deal properly
> with the cross-origin issues, in the same way texImage2D does.
Uploading an image to be used as vertex data is a hack. You'll only be
guaranteed lossless data transfer with PNGs. I don't think we would
want to add these entry points in the general case as they would
promote poor application development practices. Why do you not want to
download binary data?
A couple of corrections to your original email. I don't believe there
is a way to transfer a texture into a buffer object natively with
OpenGL ES 2.0 APIs, as glGetTexImage is not available. Second, some
WebGL implementations today do support floating point textures via the
OES_texture_float extension; see
http://www.khronos.org/registry/webgl/extensions/ .
-Ken
> --
> Glenn Maynard
> -----------------------------------------------------------
> 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
> -----------------------------------------------------------
>
>
-----------------------------------------------------------
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
-----------------------------------------------------------