Does Three.js support OES_texture_float?

I want to display the position or depth of a floating texture. I use

vsnTexture = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight,
            { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat ,type:THREE.FloatType }); 

as a rendering target.

Then i tested

var gl = this.renderer.getContext();
    if( !gl.getExtension( "OES_texture_float" ) ){
        console.error( "No OES_texture_float support for float textures!" );
    } 

and did not find an error. Chrome supports OES_texture_float, and I enter THREE.js:

_gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
 //console.log(glType);

I found glType = 5126 (gl.FLOAT) when I set WebGLRenderTarget: type: THREE.FloatType. This means that I could use OES_texture_float. Is something wrong with me? Because no matter what I set the type to: THREE.FloatType or use the default value (THREE.UnsignedByteType), I get the same rendering texture. Am I using it correctly OES_texture_float?

+4
source share

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


All Articles