GLRenderer: enable seamless cubemap globally

experimental
Kirill Vainer 10 years ago
parent 0bfa7bfacd
commit 5845671409
  1. 3
      jme3-core/src/main/java/com/jme3/renderer/RenderContext.java
  2. 17
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

@ -255,8 +255,6 @@ public class RenderContext {
public ColorRGBA clearColor = new ColorRGBA(0,0,0,0);
public boolean seamlessCubemap = false;
/**
* Reset the RenderContext to default GL state
*/
@ -308,6 +306,5 @@ public class RenderContext {
depthFunc = RenderState.TestFunction.LessOrEqual;
alphaFunc = RenderState.TestFunction.Greater;
clearColor.set(0,0,0,0);
seamlessCubemap = false;
}
}

@ -503,6 +503,11 @@ public class GLRenderer implements Renderer {
// Initialize default state..
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
if (caps.contains(Caps.SeamlessCubemap)) {
// Enable this globally. Should be OK.
gl.glEnable(GLExt.GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
if (caps.contains(Caps.CoreProfile)) {
// Core Profile requires VAO to be bound.
@ -1833,18 +1838,6 @@ public class GLRenderer implements Renderer {
gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
image.getLastTextureState().minFilter = tex.getMinFilter();
}
if (caps.contains(Caps.SeamlessCubemap) && tex.getType() == Texture.Type.CubeMap) {
if (haveMips && !context.seamlessCubemap) {
// We can enable seamless cubemap filtering.
gl.glEnable(GLExt.GL_TEXTURE_CUBE_MAP_SEAMLESS);
context.seamlessCubemap = true;
} else if (!haveMips && context.seamlessCubemap) {
// For skyboxes (no mipmaps), disable seamless cubemap filtering.
gl.glDisable(GLExt.GL_TEXTURE_CUBE_MAP_SEAMLESS);
context.seamlessCubemap = false;
}
}
if (tex.getAnisotropicFilter() > 1) {
if (caps.contains(Caps.TextureFilterAnisotropic)) {
gl.glTexParameterf(target,

Loading…
Cancel
Save