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 <t.broyer@gmail.com>
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.See http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#security-with-canvas-elementsRootLayoutPanel.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 activethis.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 objectthis.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 ?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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
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/ 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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
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.
No comments:
Post a Comment