Textures JOGL微光/纹理闪烁问题

Textures JOGL微光/纹理闪烁问题,textures,jogl,antialiasing,mipmaps,Textures,Jogl,Antialiasing,Mipmaps,我在JOGL程序中遇到了纹理问题。 我在一个立方体上绘制的纹理是从一个显示列表中提取的,它们在闪烁。 下面是一段视频,显示了问题: (为这段糟糕的视频感到抱歉,我不知道一开始出了什么问题) 首先,我认为这将是一个反Alizing问题,但我使用了更平滑的纹理,问题仍然存在。然后我在纹理上启用了mipmapping,但运气不好。 结果总是一样的 下面是我第一次用来准备纹理的代码。这是没有mipmapping的 final int[] tmp = new int[1]; gl.glGenTex

我在JOGL程序中遇到了纹理问题。 我在一个立方体上绘制的纹理是从一个显示列表中提取的,它们在闪烁。 下面是一段视频,显示了问题: (为这段糟糕的视频感到抱歉,我不知道一开始出了什么问题) 首先,我认为这将是一个反Alizing问题,但我使用了更平滑的纹理,问题仍然存在。然后我在纹理上启用了mipmapping,但运气不好。 结果总是一样的

下面是我第一次用来准备纹理的代码。这是没有mipmapping的

final int[] tmp = new int[1];
    gl.glGenTextures(1, tmp, 0);
    id = tmp[0];

    BufferedImage bufferedImage = null;

    int width = 0;
    int height = 0;
    try {
        bufferedImage = ImageIO.read(new File(filename));
        width = bufferedImage.getWidth();
        height = bufferedImage.getHeight();
    }
    catch (IOException e) {
        e.printStackTrace();
    }
    WritableRaster raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, 4, null);
    ComponentColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {
            8, 8, 8, 8 }, true, false, ComponentColorModel.TRANSLUCENT, DataBuffer.TYPE_BYTE);
    BufferedImage dukeImg = new BufferedImage(colorModel, raster, false, null);

    Graphics2D g = dukeImg.createGraphics();
    g.drawImage(bufferedImage, null, null);
    DataBufferByte dukeBuf = (DataBufferByte) raster.getDataBuffer();
    byte[] dukeRGBA = dukeBuf.getData();
    ByteBuffer bb = ByteBuffer.wrap(dukeRGBA);
    bb.position(0);
    bb.mark();

    gl.glBindTexture(GL2.GL_TEXTURE_2D, id);
    gl.glPixelStorei(GL2.GL_UNPACK_ALIGNMENT, 1);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
    gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);

    gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA, width, height, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, bb);

    ...
    gl.glBindTexture(GL2.GL_TEXTURE_2D, id);
然后我决定使用build-in-JOGL纹理类。我从这篇文章中得到的
settexparameter()
调用没有解决问题

try {
        TextureData textureData = TextureIO.newTextureData(drawable.getGLProfile(), new File(
            "data/images/Kachel1.png"), true, TextureIO.PNG);
        Texture tile = TextureIO.newTexture(textureData);

        tile.setTexParameteri(GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
        tile.setTexParameteri(GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
        tile.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
        tile.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
        gl.glGenerateMipmap(GL2.GL_TEXTURE_2D);
    }
    catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
所以现在我不知道该怎么做才能消除闪烁。
有什么建议吗?

Hi peter,使用mipmap,使用过滤器“GL\u LINEAR\u mipmap\u LINEAR”并使用任意各向异性过滤器Hi peter,使用mipmap,使用过滤器“GL\u LINEAR\u mipmap\u LINEAR”并使用任意各向异性过滤器