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

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

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

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

Loading…
Cancel
Save