0

In all the examples, GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER are always set before glTexImage2D is called. Is there any reason for this?

I know that they have to be set (or you have to make mipmaps) before the texture is usable, but is there anything wrong with setting them after glTexImage2D?

Examples:

GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GL11.glTexImage2D(target, 0, GL_RGBA8, t_width, t_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureBuffer);

vs

GL11.glTexImage2D(target, 0, GL_RGBA8, t_width, t_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureBuffer);
GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, GL_NEAREST);
4

1 に答える 1

2

いいえ、違いはありません。これらは、テクスチャがサンプリングされたときにのみ効果がありますが、これはかなり後で行われます。

于 2012-05-09T18:59:12.523 に答える