From c274675660fc69816c442c26bc2e79e109055b73 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Sun, 2 Nov 2014 19:11:27 -0500 Subject: [PATCH] FilterPostProcessor: Add fallback to RGB8 in case RGB111110F is not supported (OGL2 / ES2 GPUs) Post processing now works on Android again. --- .../main/java/com/jme3/post/FilterPostProcessor.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index 92016aa12..39dac1c7b 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/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 multiView = false; + private Format fbFormat = Format.RGB111110F; + /** * Create a FilterProcessor * @param assetManager the assetManager @@ -139,8 +141,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { fsQuad.setHeight(1); if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { - throw new RendererException("FilterPostProcessor requires the " + - "video hardware to support packed float texture."); + fbFormat = Format.RGB8; } Camera cam = vp.getCamera(); @@ -443,7 +444,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample)) { renderFrameBufferMS = new FrameBuffer(width, height, numSamples); 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); renderFrameBufferMS.setDepthTexture(msDepth); renderFrameBufferMS.setColorTexture(msColor); @@ -451,14 +452,14 @@ public class FilterPostProcessor implements SceneProcessor, Savable { depthTexture = msDepth; } else { renderFrameBufferMS.setDepthBuffer(Format.Depth); - renderFrameBufferMS.setColorBuffer(Format.RGB111110F); + renderFrameBufferMS.setColorBuffer(fbFormat); } } if (numSamples <= 1 || !caps.contains(Caps.OpenGL31)) { renderFrameBuffer = new FrameBuffer(width, height, 1); renderFrameBuffer.setDepthBuffer(Format.Depth); - filterTexture = new Texture2D(width, height, Format.RGB111110F); + filterTexture = new Texture2D(width, height, fbFormat); renderFrameBuffer.setColorTexture(filterTexture); }