SDK scene viewer and previews are now gamma corrected

experimental
Nehon 10 years ago
parent 2aa50694b8
commit 55195bd996
  1. 4
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  2. 4
      sdk/jme3-core/src/com/jme3/gde/core/scene/ScenePreviewProcessor.java

@ -136,9 +136,11 @@ public class SceneApplication extends Application implements LookupProvider {
public SceneApplication() { public SceneApplication() {
Logger.getLogger("com.jme3").addHandler(logHandler); Logger.getLogger("com.jme3").addHandler(logHandler);
useCanvas = "true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false")); useCanvas = "true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"));
Logger.getLogger("com.jme3.renderer.opengl.TextureUtil").setLevel(Level.SEVERE);
try { try {
AppSettings newSetting = new AppSettings(true); AppSettings newSetting = new AppSettings(true);
newSetting.setFrameRate(30); newSetting.setFrameRate(30);
newSetting.setGammaCorrection(true);
if (!useCanvas) { if (!useCanvas) {
newSetting.setCustomRenderer(AwtPanelsContext.class); newSetting.setCustomRenderer(AwtPanelsContext.class);
} }
@ -169,7 +171,7 @@ public class SceneApplication extends Application implements LookupProvider {
return ((JmeCanvasContext) getContext()).getCanvas(); return ((JmeCanvasContext) getContext()).getCanvas();
} else { } else {
if (panel == null) { if (panel == null) {
panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated); panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated, true);
((AwtPanelsContext) getContext()).setInputSource(panel); ((AwtPanelsContext) getContext()).setInputSource(panel);
attachPanel(); attachPanel();
} }

@ -37,6 +37,7 @@ import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor; import com.jme3.post.SceneProcessor;
import com.jme3.renderer.Camera; import com.jme3.renderer.Camera;
import com.jme3.renderer.Caps;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue; import com.jme3.renderer.queue.RenderQueue;
@ -49,6 +50,8 @@ import java.awt.image.DataBufferByte;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
@ -115,6 +118,7 @@ public class ScenePreviewProcessor implements SceneProcessor {
//setup framebuffer to use texture //setup framebuffer to use texture
offBuffer.setDepthBuffer(Format.Depth); offBuffer.setDepthBuffer(Format.Depth);
offBuffer.setColorBuffer(Format.RGBA8); offBuffer.setColorBuffer(Format.RGBA8);
offBuffer.setSrgb(true);
//set viewport to render to offscreen framebuffer //set viewport to render to offscreen framebuffer
offView.setOutputFrameBuffer(offBuffer); offView.setOutputFrameBuffer(offBuffer);

Loading…
Cancel
Save