Hi Thomas,

Thanks for you answer.

Following your suggestion ( new Image(myImageResource) ), there is no more
security error :)

All my textures are loaded but are almost empties. According to
WebGLInspector all textures have size 1x1 with a transparent pixel.
It looks like that the HTMLImageElement obtained via image.getElement() is
not properly filled now.

An idea about that ?

Regards,
Harold




2013/3/4 Thomas Broyer <[email protected]>

> On Sunday, March 3, 2013 10:52:29 PM UTC+1, Harold wrote:
>
>> Hi all,
>>
>> I am using super dev mode and i have an issue, i think,, with same origin
>> policy.
>>
>> I have a ClientBundle containing many ImageResource which will be used as
>> WebGL textures.
>>
>> To load those images i do :
>>
>> Image image = new Image(myImageResource.**getSafeUri().asString();
>>
>
> Don't do that. Use new Image(myImageResource), or use a DataResource.
>
>
>> RootLayoutPanel.get().add(**image);
>> image.setVisible(false);
>> this.img.addLoadHandler(this);
>> this.img.addErrorHandler(this)**;
>>
>> where this is a class implenting LoadHandler and ErrorHandler.
>>
>> Then in the onLoad method :
>>
>> this.InitializeTexture(this.**img.getElement());
>> RootLayoutPanel.get().remove(**this.img);
>>
>> And finally the InitializeTexture :
>>
>> /**
>> * \brief Initializes the gl texture with the loaded image.
>> */
>> public void InitializeTexture(Element inElement)
>> {
>>         // Set current texture object as active
>> this.Bind(**WebGLRenderingContext.TEXTURE_**2D);
>>   // If generating mipmap is requested, parameter the texture filtering
>> to using them and generate mipmaps ...
>>  if(this.generateMipmap)
>> {
>> this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**MAG_FILTER,
>> WebGLRenderingContext.LINEAR);
>>  this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**MIN_FILTER, WebGLRenderingContext.LINEAR_
>> **MIPMAP_NEAREST);
>> this.gl.generateMipmap(**WebGLRenderingContext.TEXTURE_**2D);
>>  }
>> else // else do not use mipmap
>> {
>> this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**MAG_FILTER,
>> WebGLRenderingContext.LINEAR);
>>  this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**MIN_FILTER,
>> WebGLRenderingContext.LINEAR);
>> }
>>  this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**WRAP_S, WebGLRenderingContext.CLAMP_**
>> TO_EDGE);
>>  this.gl.texParameteri(**WebGLRenderingContext.TEXTURE_**2D,
>> WebGLRenderingContext.TEXTURE_**WRAP_T, WebGLRenderingContext.CLAMP_**
>> TO_EDGE);
>>  // And finaly, set the image pixels data in the texture object.
>> this.gl.texImage2D(**WebGLRenderingContext.TEXTURE_**2D, 0,
>> WebGLRenderingContext.RGBA, WebGLRenderingContext.RGBA,
>> WebGLRenderingContext.**UNSIGNED_BYTE, inElement);
>>  // Finaly unbind the texture object
>> this.Unbind(**WebGLRenderingContext.TEXTURE_**2D);
>> }
>>
>> All is ok in production mode but when i use superdevmode i get under
>> chrome and firefox a security error while calling texImage2D method.
>>
>> Do you think that is a SOP issue ?
>>
>
> See
> http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#security-with-canvas-elements
> Though SuperDevMode sends "Access-Control-Allow-Origin: *" so it should
> work…
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
*Small WebGL 3D engine for GWT*
*http://code.google.com/p/ethereal-engine/*<http://code.google.com/p/ethereal-engine/>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to