WebGL video rendering on iOS 10 beta 7 (Safari) - shows weird magenta colors

I process video in webGL, passing the Videoobject as a source to texImage2D.
This works fine on all platforms (supporting webGL), however on Safari on iOS 10 beta 7 it displays using weird colors (it looks fine in previous versions of iOS).

For example, this is a frame of an image from it that looks like it expected: enter image description here

And so it is displayed in iOS 10 (weird version):

enter image description here

Is this an IOS10 beta bug?

Here is the visualization code (what happens for each frame):

gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);        
gl.bindTexture(gl.TEXTURE_2D, frameTexture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.bindTexture(gl.TEXTURE_2D, null);

frameTexture - 2D-, . Video - Video.
, , holds .

:

Vertex

attribute vec3 a_position;
attribute vec2 a_texCoord;
uniform vec2 u_resolution;
varying vec2 v_texCoord;

void main() {
    vec4 pos = vec4(a_position, 1.0);
    vec2 xy = vec2(pos.x,pos.y);

    // convert the rectangle from pixels to 0.0 to 1.0
    vec2 zeroToOne = xy / u_resolution;
    // convert from 0->1 to 0->2
    vec2 zeroToTwo = zeroToOne * 2.0;
    // convert from 0->2 to -1->+1 (clipspace)
    vec2 clipSpace = zeroToTwo - 1.0;
    gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
    // pass the texCoord to the fragment shader
    // The GPU will interpolate this value between points.
    v_texCoord = a_texCoord;        
}

u_resolution JS .

precision mediump float;

// our texture
uniform sampler2D u_image;
// the texCoords passed in from the vertex shader.
varying vec2 v_texCoord;

void main() {
   gl_FragColor = texture2D(u_image, v_texCoord);
}

- . , .

IOS10 webGL - , ?
( , webGL)

+4
1

WebKit ( Safari iOS). WebKit: https://webkit.org/reporting-bugs/.

+1

Source: https://habr.com/ru/post/1652328/


All Articles