[Webkit-unassigned] [Bug 31948] New: texImage2D should allow null pixel data

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 27 19:41:41 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31948

           Summary: texImage2D should allow null pixel data
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebGL
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ben.vanik at gmail.com


As per the spec of glTexImage2D, the last argument (data) is allowed to be NULL
to indicate that an empty texture should be created.
It looks like right now GraphicsContext3D::texImage2D does no checking on
pixels, which may be NULL so an error is thrown if you try.

Spec: http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml

Workaround:
function emptyTexImage2D(gl, internalFormat, width, height, format, type) {
    try {
        gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0,
format, type, null);
    } catch (e) {
        console.warn("browser texImage2D does not accept null - sending up a
real blank texture");
        var pixels = new WebGLUnsignedByteArray(width * height * (
internalFormat == gl.RGBA ? 4 : 3 ) );
        gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0,
format, type, pixels);
    }
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list