|
|
@ -1757,7 +1757,8 @@ public class LwjglRenderer implements Renderer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int convertMinFilter(Texture.MinFilter filter) { |
|
|
|
private int convertMinFilter(Texture.MinFilter filter, boolean haveMips) { |
|
|
|
|
|
|
|
if (haveMips){ |
|
|
|
switch (filter) { |
|
|
|
switch (filter) { |
|
|
|
case Trilinear: |
|
|
|
case Trilinear: |
|
|
|
return GL_LINEAR_MIPMAP_LINEAR; |
|
|
|
return GL_LINEAR_MIPMAP_LINEAR; |
|
|
@ -1774,6 +1775,20 @@ public class LwjglRenderer implements Renderer { |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new UnsupportedOperationException("Unknown min filter: " + filter); |
|
|
|
throw new UnsupportedOperationException("Unknown min filter: " + filter); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
switch (filter) { |
|
|
|
|
|
|
|
case Trilinear: |
|
|
|
|
|
|
|
case BilinearNearestMipMap: |
|
|
|
|
|
|
|
case BilinearNoMipMaps: |
|
|
|
|
|
|
|
return GL_LINEAR; |
|
|
|
|
|
|
|
case NearestLinearMipMap: |
|
|
|
|
|
|
|
case NearestNearestMipMap: |
|
|
|
|
|
|
|
case NearestNoMipMaps: |
|
|
|
|
|
|
|
return GL_NEAREST; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
throw new UnsupportedOperationException("Unknown min filter: " + filter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int convertWrapMode(Texture.WrapMode mode) { |
|
|
|
private int convertWrapMode(Texture.WrapMode mode) { |
|
|
@ -1798,8 +1813,14 @@ public class LwjglRenderer implements Renderer { |
|
|
|
Image image = tex.getImage(); |
|
|
|
Image image = tex.getImage(); |
|
|
|
int target = convertTextureType(tex.getType(), image != null ? image.getMultiSamples() : 1, -1); |
|
|
|
int target = convertTextureType(tex.getType(), image != null ? image.getMultiSamples() : 1, -1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean haveMips = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (image != null) { |
|
|
|
|
|
|
|
haveMips = image.isGeneratedMipmapsRequired() || image.hasMipmaps(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// filter things
|
|
|
|
// filter things
|
|
|
|
int minFilter = convertMinFilter(tex.getMinFilter()); |
|
|
|
int minFilter = convertMinFilter(tex.getMinFilter(), haveMips); |
|
|
|
int magFilter = convertMagFilter(tex.getMagFilter()); |
|
|
|
int magFilter = convertMagFilter(tex.getMagFilter()); |
|
|
|
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter); |
|
|
|
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter); |
|
|
|
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter); |
|
|
|
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter); |
|
|
|