Support ABGR8 using swizzle extension

opengles2-fixes
Kirill Vainer 7 years ago
parent 23700d5140
commit 7a22f8c940
  1. 1
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java
  2. 11
      jme3-core/src/main/java/com/jme3/renderer/opengl/TextureUtil.java

@ -50,6 +50,7 @@ public interface GL {
public static final int GL_ARRAY_BUFFER = 0x8892; public static final int GL_ARRAY_BUFFER = 0x8892;
public static final int GL_BACK = 0x405; public static final int GL_BACK = 0x405;
public static final int GL_BLEND = 0xBE2; public static final int GL_BLEND = 0xBE2;
public static final int GL_BLUE = 0x1905;
public static final int GL_BYTE = 0x1400; public static final int GL_BYTE = 0x1400;
public static final int GL_CLAMP_TO_EDGE = 0x812F; public static final int GL_CLAMP_TO_EDGE = 0x812F;
public static final int GL_COLOR_BUFFER_BIT = 0x4000; public static final int GL_COLOR_BUFFER_BIT = 0x4000;

@ -32,7 +32,6 @@
package com.jme3.renderer.opengl; package com.jme3.renderer.opengl;
import com.jme3.renderer.Caps; import com.jme3.renderer.Caps;
import com.jme3.renderer.RenderContext;
import com.jme3.renderer.RendererException; import com.jme3.renderer.RendererException;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import com.jme3.texture.Image.Format; import com.jme3.texture.Image.Format;
@ -91,7 +90,7 @@ final class TextureUtil {
public GLImageFormat getImageFormatWithError(Format fmt, boolean isSrgb) { public GLImageFormat getImageFormatWithError(Format fmt, boolean isSrgb) {
//if the passed format is one kind of depth there isno point in getting the srgb format; //if the passed format is one kind of depth there isno point in getting the srgb format;
isSrgb = isSrgb && fmt != Format.Depth && fmt != Format.Depth16 && fmt != Format.Depth24 && fmt != Format.Depth24Stencil8 && fmt != Format.Depth32 && fmt != Format.Depth32F; isSrgb = isSrgb && !fmt.isDepthFormat();
GLImageFormat glFmt = getImageFormat(fmt, isSrgb); GLImageFormat glFmt = getImageFormat(fmt, isSrgb);
if (glFmt == null && isSrgb) { if (glFmt == null && isSrgb) {
glFmt = getImageFormat(fmt, false); glFmt = getImageFormat(fmt, false);
@ -127,6 +126,14 @@ final class TextureUtil {
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_B, GL.GL_RED); gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_B, GL.GL_RED);
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_A, GL.GL_GREEN); gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_A, GL.GL_GREEN);
break; break;
case ABGR8:
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_R, GL.GL_ALPHA);
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_G, GL.GL_BLUE);
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_B, GL.GL_GREEN);
gl.glTexParameteri(target, GL3.GL_TEXTURE_SWIZZLE_A, GL.GL_RED);
break;
default:
throw new UnsupportedOperationException();
} }
} }

Loading…
Cancel
Save