PDA

View Full Version : readpixels problem with texturing/ texImage2D - not allowed.



titan
12-09-2009, 09:33 AM
Hello,

I hope somebody can help me.

I worked with readpixels and all was okay until I used texImage2D.
If I use readpixels and texImage2D - readpixels create the not allowed Error.


if (mCanvasElement->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
2247: LogMessage("readPixels: Not allowed");
2248: return NS_ERROR_DOM_SECURITY_ERR;
2249: }


I do not know, where the problem is.
Can I switch something off or tell something to readpixels so it will work again with textures enable?
Texturing works fine and Readpixels without Texturing fine too.

I am working with Firefox Nightly Build and tested Safari WebKit on Windows PC - same Error not allowed. :(

Thank you
Titan

ilmari
12-10-2009, 02:19 AM
If you use an image from outside the HTML page's origin as a texture (e.g. image from a different website), the canvas is flagged as confidential and you can't readPixels from it anymore. See
http://en.wikipedia.org/wiki/Same_origin_policy

titan
12-10-2009, 02:41 AM
Mhh this sounds strange.


gl.activeTexture(gl.TEXTURE0);
OBJbuffer.texturenDaten1 = gl.createTexture();
OBJbuffer.texturenImage1 = new Image();
OBJbuffer.texturenImage1.src = "nowebgl.jpg";//"nowebgl.jpg";
OBJbuffer.texturenImage1.onload = function()
{
gl.enable(gl.TEXTURE_2D);
gl.bindTexture(gl.TEXTURE_2D, OBJbuffer.texturenDaten1);
gl.texImage2D(gl.TEXTURE_2D, 0, OBJbuffer.texturenImage1);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP);
gl.bindTexture(gl.TEXTURE_2D, null);

}


I tried it. So the jpgs are in the same directory like the script. But no readpixels allowed.

Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "file:///C:/Uni/12.%20Semester/Studienarbeit/WebGL%20V1-4/index_Shader_z_werte_texturmapping.html?Eingabe=bi ld.obj Line: 614"]
Here is the Second Error after not allowed.

Thanks for your input.

titan

titan
12-10-2009, 02:52 AM
Okay, local stuff should be a security problem like other domains. So I need a local apache or so.

I used "netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead");" befor the readpixels, so there is a warning but it works.

Thanks, I never stop learning :)

Titan