* More sanity checking when enabling sRGB pipeline, to ensure its actually supported before calling any sRGB related functions. Also provide more log messages if something is odd or goes wrong.

* Remove the sanity check from TextureUtil since it is now done once during initialization of the renderer.
 * If LwjglRenderer.VALIDATE_SHADER is enabled, log shader compilation warnings as Level.WARNING instead of Level.FINE. Also slightly better grammar in shader compile / link messages.
experimental
shadowislord 11 years ago
parent ce761cd20b
commit 1a1d74f83e
  1. 42
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java
  2. 3
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/TextureUtil.java

@ -1030,10 +1030,10 @@ public class LwjglRenderer implements Renderer {
if (compiledOK) {
if (infoLog != null) {
logger.log(Level.FINE, "{0} compile success\n{1}",
logger.log(Level.WARNING, "{0} compiled successfully, compiler warnings: \n{1}",
new Object[]{source.getName(), infoLog});
} else {
logger.log(Level.FINE, "{0} compile success", source.getName());
logger.log(Level.FINE, "{0} compiled successfully.", source.getName());
}
source.clearUpdateNeeded();
} else {
@ -1102,9 +1102,9 @@ public class LwjglRenderer implements Renderer {
if (linkOK) {
if (infoLog != null) {
logger.log(Level.FINE, "shader link success. \n{0}", infoLog);
logger.log(Level.WARNING, "Shader linked successfully. Linker warnings: \n{0}", infoLog);
} else {
logger.fine("shader link success");
logger.fine("Shader linked successfully.");
}
shader.clearUpdateNeeded();
if (needRegister) {
@ -1117,9 +1117,9 @@ public class LwjglRenderer implements Renderer {
}
} else {
if (infoLog != null) {
throw new RendererException("Shader link failure, shader:" + shader + " info:" + infoLog);
throw new RendererException("Shader failure to link, shader:" + shader + " info:" + infoLog);
} else {
throw new RendererException("Shader link failure, shader:" + shader + " info: <not provided>");
throw new RendererException("Shader failure to link, shader:" + shader + " info: <not provided>");
}
}
}
@ -2553,17 +2553,35 @@ public class LwjglRenderer implements Renderer {
// }
}
public void setMainFrameBufferSrgb(boolean srgb) {
//Gamma correction
if(srgb && caps.contains(Caps.Srgb)){
public void setMainFrameBufferSrgb(boolean enableSrgb) {
// Gamma correction
if (!caps.contains(Caps.Srgb)) {
// Not supported, sorry.
logger.warning("sRGB framebuffer is not supported " +
"by video hardware, but was requested.");
return;
}
if (enableSrgb) {
if (!glGetBoolean(GL30.GL_FRAMEBUFFER_SRGB_CAPABLE)) {
logger.warning("Driver claims that default framebuffer " +
"is not sRGB capable. Enabling anyway.");
}
glEnable(GL30.GL_FRAMEBUFFER_SRGB);
logger.log(Level.FINER, "SRGB FrameBuffer enabled (Gamma Correction)");
}else{
} else {
glDisable(GL30.GL_FRAMEBUFFER_SRGB);
}
}
}
public void setLinearizeSrgbImages(boolean linearize) {
linearizeSrgbImages = linearize;
if (caps.contains(Caps.Srgb)) {
linearizeSrgbImages = linearize;
}
}
}

@ -213,9 +213,6 @@ class TextureUtil {
break;
}
if (isSrgb) {
if (!caps.OpenGL30 && !caps.GL_EXT_texture_sRGB) {
return null;
}
return getSrgbFormat(fmt);
} else {
return formatToGL[fmt.ordinal()];

Loading…
Cancel
Save