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. 8
      sdk/jme3-core/src/com/jme3/gde/core/scene/ScenePreviewProcessor.java

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

@ -37,6 +37,7 @@ import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.SceneProcessor;
import com.jme3.renderer.Camera;
import com.jme3.renderer.Caps;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue;
@ -49,6 +50,8 @@ import java.awt.image.DataBufferByte;
import java.awt.image.WritableRaster;
import java.nio.ByteBuffer;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
@ -113,8 +116,9 @@ public class ScenePreviewProcessor implements SceneProcessor {
offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
//setup framebuffer to use texture
offBuffer.setDepthBuffer(Format.Depth);
offBuffer.setDepthBuffer(Format.Depth);
offBuffer.setColorBuffer(Format.RGBA8);
offBuffer.setSrgb(true);
//set viewport to render to offscreen framebuffer
offView.setOutputFrameBuffer(offBuffer);
@ -182,7 +186,7 @@ public class ScenePreviewProcessor implements SceneProcessor {
byte g = cpuArray[i + 1];
byte r = cpuArray[i + 2];
byte a = cpuArray[i + 3];
cpuArray[i + 0] = a;
cpuArray[i + 1] = b;
cpuArray[i + 2] = g;

Loading…
Cancel
Save