绑定到纹理单元 0 的 WebGL 纹理不可渲染

WebGL texture bound to texture unit 0 is not renderable

我正在尝试为反射设置一个立方体纹理,但出现此错误:

  WebGL: drawElements: texture bound to texture unit 0 is not renderable. 
It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'.
 Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.
index.js:404 WebGL: too many errors, no more errors will be reported to the console for this context.

我确定图像 (PNG) 已正确加载,因为 console.log 打印了两个高度和宽度的正确幂...

当我尝试绘制任何东西时出现此错误,即使是在另一个着色器程序中也是如此..

下面是纹理加载的代码:

gl.useProgram(shaderProgram);
cubeMap = gl.createTexture();
gl.bindTexture(gl.TEXTURE_CUBE_MAP, cubeMap);

gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl.RGBA,
gl.RGBA, gl.UNSIGNED_BYTE, image_pos_x);
//5 more times for different faces of the cube

gl.activeTexture( gl.TEXTURE0 );
gl.uniform1i(gl.getUniformLocation(shaderProgram, "texture"),0);

尝试将这些添加到

    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

我输入:

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);  
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

在我的 activeTexture 和 bindTexture 调用之间,它对我有用。