I got always black screen for TEXTURE_MIN_FILTER.= world.GL.gl.NEAREST
world.GL.gl.activeTexture(world.GL.gl['TEXTURE' + t]);
world.GL.gl.bindTexture(world.GL.gl.TEXTURE_2D, object.textures[t]);
world.GL.gl.pixelStorei(world.GL.gl.UNPACK_FLIP_Y_WEBGL, false);
if (world.GL.extTFAnisotropic) {
world.GL.gl.texParameterf(world.GL.gl.TEXTURE_2D,
world.GL.extTFAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,
world.GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
}
world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_MAG_FILTER, object.texParams.TEXTURE_MAG_FILTER | world.GL.gl.LINEAR);
world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_MIN_FILTER, object.texParams.TEXTURE_MIN_FILTER | world.GL.gl.LINEAR);
world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_WRAP_S, object.texParams.TEXTURE_WRAP_S | world.GL.gl.REPEAT);
world.GL.gl.texParameteri(world.GL.gl.TEXTURE_2D, world.GL.gl.TEXTURE_WRAP_T, object.texParams.TEXTURE_WRAP_T | world.GL.gl.REPEAT);
world.GL.gl.uniform1i(object.shaderProgram.samplerUniform, t);
gl.LINEAR, gl.NEAREST,
gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, gl.LINEAR_MIPMAP_LINEAR.
Also if i use generate mipmap then i cant use TEXTURE_WRAP_S...
In WebGL 1.0 , if you want to use a mipmap filter, the size of the texture (width and height) must be a power of 2 (also see OpenGL ES 2.0 Full Specification ). Either make the size of the textures a power of 2 or switch to WebGL 2.0 (OpenGL ES 3.0) where this restriction does not apply.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.