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 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.
No comments:
Post a Comment