* Deprecate texture wrap modes not supported in OpenGL 3

* Make sure engine is not using them anywhere
experimental
shadowislord 11 years ago
parent c925104f5e
commit ad7fdb6fab
  1. 19
      jme3-core/src/main/java/com/jme3/texture/Texture.java
  2. 2
      jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java
  3. 2
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java
  4. 2
      jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MaterialLoader.java

@ -142,7 +142,7 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
*/
Trilinear(true);
private boolean usesMipMapLevels;
private final boolean usesMipMapLevels;
private MinFilter(boolean usesMipMapLevels) {
this.usesMipMapLevels = usesMipMapLevels;
@ -180,15 +180,20 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
* Only the fractional portion of the coordinate is considered.
*/
Repeat,
/**
* Only the fractional portion of the coordinate is considered, but if
* the integer portion is odd, we'll use 1 - the fractional portion.
* (Introduced around OpenGL1.4) Falls back on Repeat if not supported.
*/
MirroredRepeat,
/**
* coordinate will be clamped to [0,1]
*
* @deprecated Not supported by OpenGL 3
*/
@Deprecated
Clamp,
/**
* mirrors and clamps the texture coordinate, where mirroring and
@ -198,13 +203,17 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
* is the size of the one-, two-, or three-dimensional texture image in
* the direction of wrapping. (Introduced after OpenGL1.4) Falls back on
* Clamp if not supported.
*
* @deprecated Not supported by OpenGL 3
*/
@Deprecated
MirrorClamp,
/**
* coordinate will be clamped to the range [-1/(2N), 1 + 1/(2N)] where N
* is the size of the texture in the direction of clamping. Falls back
* on Clamp if not supported.
*/
*/
BorderClamp,
/**
* Wrap mode MIRROR_CLAMP_TO_BORDER_EXT mirrors and clamps to border the
@ -214,7 +223,10 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
* where N is the size of the one-, two-, or three-dimensional texture
* image in the direction of wrapping." (Introduced after OpenGL1.4)
* Falls back on BorderClamp if not supported.
*
* @deprecated Not supported by OpenGL 3
*/
@Deprecated
MirrorBorderClamp,
/**
* coordinate will be clamped to the range [1/(2N), 1 - 1/(2N)] where N
@ -222,6 +234,7 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
* on Clamp if not supported.
*/
EdgeClamp,
/**
* mirrors and clamps to edge the texture coordinate, where mirroring
* and clamping to edge a value f computes:
@ -229,6 +242,8 @@ public abstract class Texture implements CloneableSmartAsset, Savable, Cloneable
* where N is the size of the one-, two-, or three-dimensional texture
* image in the direction of wrapping. (Introduced after OpenGL1.4)
* Falls back on EdgeClamp if not supported.
*
* @deprecated Not supported by OpenGL 3
*/
MirrorEdgeClamp;
}

@ -406,7 +406,7 @@ public class TextureAtlas {
Texture2D tex = new Texture2D(new Image(format, atlasWidth, atlasHeight, BufferUtils.createByteBuffer(image), null, ColorSpace.Linear));
tex.setMagFilter(Texture.MagFilter.Bilinear);
tex.setMinFilter(Texture.MinFilter.BilinearNearestMipMap);
tex.setWrap(Texture.WrapMode.Clamp);
tex.setWrap(Texture.WrapMode.EdgeClamp);
return tex;
}
return null;

@ -1747,7 +1747,7 @@ public class LwjglRenderer implements Renderer {
case BorderClamp:
return GL_CLAMP_TO_BORDER;
case Clamp:
return GL_CLAMP;
// Falldown intentional.
case EdgeClamp:
return GL_CLAMP_TO_EDGE;
case Repeat:

@ -165,7 +165,7 @@ public class MaterialLoader implements AssetLoader {
if (mode.equals("wrap")){
textures[texUnit].setWrap(WrapMode.Repeat);
}else if (mode.equals("clamp")){
textures[texUnit].setWrap(WrapMode.Clamp);
textures[texUnit].setWrap(WrapMode.EdgeClamp);
}else if (mode.equals("mirror")){
textures[texUnit].setWrap(WrapMode.MirroredRepeat);
}else if (mode.equals("border")){

Loading…
Cancel
Save