Results 1 to 4 of 4

Thread: readpixels problem with texturing/ texImage2D - not allowed.

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    15

    readpixels problem with texturing/ texImage2D - not allowed.

    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.

    Code :
    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

  2. #2
    Junior Member
    Join Date
    Nov 2009
    Posts
    7

    Re: readpixels problem with texturing/ texImage2D - not allowed.

    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

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    15

    Re: readpixels problem with texturing/ texImage2D - not allowed.

    Mhh this sounds strange.

    Code :
        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.
    Code :
    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=bild.obj Line: 614"]
    Here is the Second Error after not allowed.

    Thanks for your input.

    titan

  4. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    15

    Re: readpixels problem with texturing/ texImage2D - not allowed.

    Okay, local stuff should be a security problem like other domains. So I need a local apache or so.

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

    Thanks, I never stop learning

    Titan

Similar Threads

  1. readPixels on framebuffer problem
    By Jens1 in forum Developers Coding:Beginner
    Replies: 2
    Last Post: 01-28-2012, 08:49 AM
  2. webGL texturing problem
    By stefomitev in forum Developers Coding:Beginner
    Replies: 1
    Last Post: 05-30-2011, 03:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •