Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
加载调色板/atitc DDS时Android Opengl ES纹理压缩问题(无效枚举)_Android_Opengl Es_Textures - Fatal编程技术网

加载调色板/atitc DDS时Android Opengl ES纹理压缩问题(无效枚举)

加载调色板/atitc DDS时Android Opengl ES纹理压缩问题(无效枚举),android,opengl-es,textures,Android,Opengl Es,Textures,目前,我在android上的OpenGL ES 1.0上加载DDS压缩纹理时遇到问题(使用Compressionator生成):每当我调用GLCompressedEximage2D时,每次都会得到一个GLU无效枚举。下面是有问题的代码: gl.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, -mipMapCount, GL11.GL_PALETTE4_RGBA8_OES, width, height, 0, tsz, texBuf); 变量tsz计算为纹理

目前,我在android上的OpenGL ES 1.0上加载DDS压缩纹理时遇到问题(使用Compressionator生成):每当我调用GLCompressedEximage2D时,每次都会得到一个GLU无效枚举。下面是有问题的代码:

gl.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, -mipMapCount, GL11.GL_PALETTE4_RGBA8_OES, width, height, 0, tsz, texBuf);
变量
tsz
计算为纹理的pitchOrLinearSize连续除以4,直到它为1字节(我的纹理为正方形)。texBuf是一个
字节缓冲
和mipMapCount。当我这样做时,我会得到一个GL_INVALID_ENUM错误代码,并且不会加载任何内容。加载ATC压缩纹理(使用adreno gpu)时也会发生同样的情况

我正在用模拟器(带调色板纹理)和我的手机(基于MSM720x的芯片组,相当于HTC Magic,两种类型)进行测试,但都没有用

以下是完整的违规代码:

                        ByteBuffer texBuf = ByteBuffer.allocateDirect(tsz);
                        int ld = fis.getChannel().read(texBuf);
                        if (ld == tsz) {
                            int id = newTextureID(gl);
                            gl.glBindTexture(GL11.GL_TEXTURE_2D, id);

                            // Set all of our texture parameters:
                            gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
                            gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
                            gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
                            gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

                            texBuf.position(0);
                            //gl.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, -mipMapCount, GL11.GL_PALETTE4_RGBA8_OES, width, height, 0, tsz, texBuf);
                            gl.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, -mipMapCount, GL11.GL_PALETTE4_RGBA8_OES, width, height, 0, pitchOrLinearSize, texBuf);

                            int err = gl.glGetError();

                            if (err == GL11.GL_INVALID_VALUE) {
                                Log.d("TDL-dds", "Error INVALID_VALUE");
                            } else if (err == GL11.GL_INVALID_ENUM) {
                                Log.d("TDL-dds", "Error INVALID_ENUM");
                            }

                            if (err != 0) {
                                int texs[] = new int[1];
                                texs[0] = id;
                                gl.glDeleteTextures(1, texs, 0);
                                return 0;
                            }
                            return id;
                        }

有人知道我为什么会出现无效枚举错误吗?

我认为你必须使用“GL\u ATC\u RGB\u AMD”而不是“GL\u palete4\u RGBA8\u”


从这里了解到::

我在教程中尝试实现相同的功能,但没有成功。我试图加载一个调色板纹理和一个ATC_RGB纹理,但没有得到任何积极的结果。我发现成功加载纹理的唯一方法是从ETC1Util类,而这些类不处理alpha通道:-(bummer)