Allow render buffers to use 'Depth' format even if depth textures are not supported.

Fixes post processing on GPUs without depth texture support (e.g. NVIDIA Tegra)
experimental
shadowislord 10 years ago
parent c274675660
commit 3ef5505faa
  1. 2
      jme3-android/src/main/java/com/jme3/renderer/android/OGLESShaderRenderer.java
  2. 9
      jme3-android/src/main/java/com/jme3/renderer/android/TextureUtil.java

@ -1283,7 +1283,7 @@ public class OGLESShaderRenderer implements Renderer {
+ ":" + fb.getHeight() + " is not supported.");
}
AndroidGLImageFormat imageFormat = TextureUtil.getImageFormat(rb.getFormat());
AndroidGLImageFormat imageFormat = TextureUtil.getImageFormat(rb.getFormat(), true);
if (imageFormat.renderBufferStorageFormat == 0) {
throw new RendererException("The format '" + rb.getFormat() + "' cannot be used for renderbuffers.");
}

@ -265,7 +265,8 @@ public class TextureUtil {
throw new UnsupportedOperationException("The image format '" + fmt + "' is unsupported by the video hardware.");
}
public static AndroidGLImageFormat getImageFormat(Format fmt) throws UnsupportedOperationException {
public static AndroidGLImageFormat getImageFormat(Format fmt, boolean forRenderBuffer)
throws UnsupportedOperationException {
AndroidGLImageFormat imageFormat = new AndroidGLImageFormat();
switch (fmt) {
case RGBA16:
@ -352,7 +353,7 @@ public class TextureUtil {
break;
case Depth:
case Depth16:
if (!DEPTH_TEXTURE) {
if (!DEPTH_TEXTURE && !forRenderBuffer) {
unsupportedFormat(fmt);
}
imageFormat.format = GLES20.GL_DEPTH_COMPONENT;
@ -434,7 +435,7 @@ public class TextureUtil {
+ "are not supported by the video hardware "
+ "and no scaling path available for image: " + img);
}
AndroidGLImageFormat imageFormat = getImageFormat(fmt);
AndroidGLImageFormat imageFormat = getImageFormat(fmt, false);
if (data != null) {
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
@ -527,7 +528,7 @@ public class TextureUtil {
+ "are not supported by the video hardware "
+ "and no scaling path available for image: " + img);
}
AndroidGLImageFormat imageFormat = getImageFormat(fmt);
AndroidGLImageFormat imageFormat = getImageFormat(fmt, false);
if (data != null) {
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);

Loading…
Cancel
Save