assuming npot texture support, auto mipmaps generation, etc, are part of

core gl profile when using gl3
This commit is contained in:
codeanticode
2013-10-24 12:17:50 -04:00
parent 56317a8827
commit 1ce9c9d360
4 changed files with 93 additions and 27 deletions

View File

@@ -36,8 +36,6 @@ import java.util.NoSuchElementException;
*
*/
public class Texture implements PConstants {
// texture constants
/**
* Texture with normalized UV.
*/
@@ -1438,21 +1436,27 @@ public class Texture implements PConstants {
throw new RuntimeException("Unknown texture format");
}
boolean mipmaps = params.mipmaps && PGL.MIPMAPS_ENABLED;
if (mipmaps && !PGraphicsOpenGL.autoMipmapGenSupported) {
PGraphics.showWarning("Mipmaps were requested but automatic mipmap " +
"generation is not supported and manual " +
"generation still not implemented, so mipmaps " +
"will be disabled.");
mipmaps = false;
}
if (params.sampling == POINT) {
glMagFilter = PGL.NEAREST;
glMinFilter = PGL.NEAREST;
} else if (params.sampling == LINEAR) {
glMagFilter = PGL.NEAREST;
glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ?
PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
} else if (params.sampling == BILINEAR) {
glMagFilter = PGL.LINEAR;
glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ?
PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
} else if (params.sampling == TRILINEAR) {
glMagFilter = PGL.LINEAR;
glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ?
PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
} else {
throw new RuntimeException("Unknown texture filtering mode");
}