FilterPostProcessor: Add fallback to RGB8 in case RGB111110F is not supported (OGL2 / ES2 GPUs)

Post processing now works on Android again.
experimental
shadowislord 10 years ago
parent 592d0a0793
commit c274675660
  1. 11
      jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java

@ -80,6 +80,8 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
private boolean cameraInit = false; private boolean cameraInit = false;
private boolean multiView = false; private boolean multiView = false;
private Format fbFormat = Format.RGB111110F;
/** /**
* Create a FilterProcessor * Create a FilterProcessor
* @param assetManager the assetManager * @param assetManager the assetManager
@ -139,8 +141,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
fsQuad.setHeight(1); fsQuad.setHeight(1);
if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) {
throw new RendererException("FilterPostProcessor requires the " + fbFormat = Format.RGB8;
"video hardware to support packed float texture.");
} }
Camera cam = vp.getCamera(); Camera cam = vp.getCamera();
@ -443,7 +444,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample)) { if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample)) {
renderFrameBufferMS = new FrameBuffer(width, height, numSamples); renderFrameBufferMS = new FrameBuffer(width, height, numSamples);
if (caps.contains(Caps.OpenGL31)) { if (caps.contains(Caps.OpenGL31)) {
Texture2D msColor = new Texture2D(width, height, numSamples, Format.RGB111110F); Texture2D msColor = new Texture2D(width, height, numSamples, fbFormat);
Texture2D msDepth = new Texture2D(width, height, numSamples, Format.Depth); Texture2D msDepth = new Texture2D(width, height, numSamples, Format.Depth);
renderFrameBufferMS.setDepthTexture(msDepth); renderFrameBufferMS.setDepthTexture(msDepth);
renderFrameBufferMS.setColorTexture(msColor); renderFrameBufferMS.setColorTexture(msColor);
@ -451,14 +452,14 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
depthTexture = msDepth; depthTexture = msDepth;
} else { } else {
renderFrameBufferMS.setDepthBuffer(Format.Depth); renderFrameBufferMS.setDepthBuffer(Format.Depth);
renderFrameBufferMS.setColorBuffer(Format.RGB111110F); renderFrameBufferMS.setColorBuffer(fbFormat);
} }
} }
if (numSamples <= 1 || !caps.contains(Caps.OpenGL31)) { if (numSamples <= 1 || !caps.contains(Caps.OpenGL31)) {
renderFrameBuffer = new FrameBuffer(width, height, 1); renderFrameBuffer = new FrameBuffer(width, height, 1);
renderFrameBuffer.setDepthBuffer(Format.Depth); renderFrameBuffer.setDepthBuffer(Format.Depth);
filterTexture = new Texture2D(width, height, Format.RGB111110F); filterTexture = new Texture2D(width, height, fbFormat);
renderFrameBuffer.setColorTexture(filterTexture); renderFrameBuffer.setColorTexture(filterTexture);
} }

Loading…
Cancel
Save