So after this
I came across this fix on model viewer https://github.com/google/model-viewer/search?utf8=✓&q=EXT_shader_texture_lod&type=
that they have implemented which is deleting the shader from gl
that didn’t solve my problem
So wrote my own
export var applyExtensionCompatibility = function (gl) {
console.log("ext");
function createShader (gl, sourceCode, type) {
var shader = gl.createShader( type );
gl.shaderSource( shader, sourceCode );
gl.compileShader( shader );
if ( !gl.getShaderParameter(shader, gl.COMPILE_STATUS) ) {
var info = gl.getShaderInfoLog( shader );
throw 'Could not compile WebGL program. \n\n' + info;
}
return shader;
}
let shader = createShader(gl,`
#extension GL_EXT_shader_texture_lod : enable
precision mediump float;
uniform sampler2D tex;
void main() {
gl_FragColor = texture2DLodEXT(tex, vec2(0.0, 0.0), 0.0);
}`,gl.FRAGMENT_SHADER)
gl.deleteShader(shader);
};
which also does the same but written explicitly
which also didn’t work
but I did get this from the code I wrote (that was based on MDN)
WebGLUtils.js:41 Uncaught Could not compile WebGL program.
WARNING: 0:2: 'GL_EXT_shader_texture_lod' : extension is not supported
ERROR: 0:6: 'texture2DLodEXT' : no matching overloaded function found
ERROR: 0:6: '=' : dimension mismatch
ERROR: 0:6: 'assign' : cannot convert from 'const mediump float' to 'FragColor mediump 4-component vector of float'
Some stuff I found by researching what it is
https://www.w3.org/standards/faq#std
still I am not able to write a patch though
but can confirm the same 3D model works flawlessly on Model Viewer
Just not on our project it’s glitching (as you can see on the previous comment)
cc @Mugen87 @mrdoob any help would be appreciated
or it can’t be fixed because EXT_shader_texture_lod is not available particularly on OnePlus 7’s GPU? (tested on like 3 oneplus 7 phones everything is glitching it’s this device specific)