Committed a patch for ARGB8 and BGRA8 support

http://hub.jmonkeyengine.org/forum/topic/support-for-argb8-and-bgra8-textures/#260706

Also made the change for Jogl TextureUtil as it was missing from the patch

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11086 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent 8c2c62d01f
commit df66664f98
  1. 10
      engine/src/core/com/jme3/texture/Image.java
  2. 4
      engine/src/core/com/jme3/texture/image/ImageCodec.java
  3. 8
      engine/src/desktop/jme3tools/converters/ImageToAwt.java
  4. 2
      engine/src/jogl/com/jme3/renderer/jogl/TextureUtil.java
  5. 2
      engine/src/lwjgl/com/jme3/renderer/lwjgl/TextureUtil.java

@ -149,6 +149,16 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
*/ */
ABGR8(32), ABGR8(32),
/**
* 8-bit alpha, red, blue and green
*/
ARGB8(32),
/**
* 8-bit blue, green, red and alpha.
*/
BGRA8(32),
/** /**
* 16-bit red, green, blue and alpha * 16-bit red, green, blue and alpha
*/ */

@ -134,6 +134,10 @@ abstract class ImageCodec {
params.put(Format.ABGR8, new ByteOffsetImageCodec(4, 0, 0, 3, 2, 1)); params.put(Format.ABGR8, new ByteOffsetImageCodec(4, 0, 0, 3, 2, 1));
params.put(Format.ARGB8, new ByteOffsetImageCodec(4, 0, 0, 1, 2, 3));
params.put(Format.BGRA8, new ByteOffsetImageCodec(4, 0, 3, 2, 1, 0));
params.put(Format.ARGB4444, new BitMaskImageCodec(2, 0, params.put(Format.ARGB4444, new BitMaskImageCodec(2, 0,
4, 4, 4, 4, 4, 4, 4, 4,
12, 0, 4, 8)); 12, 0, 4, 8));

@ -172,6 +172,14 @@ public class ImageToAwt {
params.put(Format.RGBA8, new DecodeParams(4, m___x, mx___, m_x__, m__x_, params.put(Format.RGBA8, new DecodeParams(4, m___x, mx___, m_x__, m__x_,
s___x, sx___, s_x__, s__x_, s___x, sx___, s_x__, s__x_,
mxxxx, sxxxx)); mxxxx, sxxxx));
params.put(Format.BGRA8, new DecodeParams(4, m___x, m__x_, m_x__, mx___,
s___x, s__x_, s_x__, sx___,
mxxxx, sxxxx));
params.put(Format.ARGB8, new DecodeParams(4, mx___, m_x__, m__x_, m___x,
sx___, s_x__, s__x_, s___x,
mxxxx, sxxxx));
} }
private static int Ix(int x, int y, int w){ private static int Ix(int x, int y, int w){

@ -123,6 +123,8 @@ public class TextureUtil {
// RGB formats // RGB formats
setFormat(Format.BGR8, GL.GL_RGB8, GL2GL3.GL_BGR, GL.GL_UNSIGNED_BYTE, false); setFormat(Format.BGR8, GL.GL_RGB8, GL2GL3.GL_BGR, GL.GL_UNSIGNED_BYTE, false);
setFormat(Format.ARGB8, GL.GL_RGBA8, GL.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8_REV, false);
setFormat(Format.BGRA8, GL.GL_RGBA8, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, false);
setFormat(Format.RGB8, GL.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, false); setFormat(Format.RGB8, GL.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, false);
// setFormat(Format.RGB10, GL11.GL_RGB10, GL11.GL_RGB, GL12.GL_UNSIGNED_INT_10_10_10_2, false); // setFormat(Format.RGB10, GL11.GL_RGB10, GL11.GL_RGB, GL12.GL_UNSIGNED_INT_10_10_10_2, false);
setFormat(Format.RGB16, GL2GL3.GL_RGB16, GL.GL_RGB, GL.GL_UNSIGNED_SHORT, false); setFormat(Format.RGB16, GL2GL3.GL_RGB16, GL.GL_RGB, GL.GL_UNSIGNED_SHORT, false);

@ -107,6 +107,8 @@ class TextureUtil {
// RGB formats // RGB formats
setFormat(Format.BGR8, GL11.GL_RGB8, EXTBgra.GL_BGR_EXT, GL11.GL_UNSIGNED_BYTE, false); setFormat(Format.BGR8, GL11.GL_RGB8, EXTBgra.GL_BGR_EXT, GL11.GL_UNSIGNED_BYTE, false);
setFormat(Format.ARGB8, GL11.GL_RGBA8, EXTBgra.GL_BGRA_EXT, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, false);
setFormat(Format.BGRA8, GL11.GL_RGBA8, EXTBgra.GL_BGRA_EXT, GL11.GL_UNSIGNED_BYTE, false);
setFormat(Format.RGB8, GL11.GL_RGB8, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, false); setFormat(Format.RGB8, GL11.GL_RGB8, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, false);
// setFormat(Format.RGB10, GL11.GL_RGB10, GL11.GL_RGB, GL12.GL_UNSIGNED_INT_10_10_10_2, false); // setFormat(Format.RGB10, GL11.GL_RGB10, GL11.GL_RGB, GL12.GL_UNSIGNED_INT_10_10_10_2, false);
setFormat(Format.RGB16, GL11.GL_RGB16, GL11.GL_RGB, GL11.GL_UNSIGNED_SHORT, false); setFormat(Format.RGB16, GL11.GL_RGB16, GL11.GL_RGB, GL11.GL_UNSIGNED_SHORT, false);

Loading…
Cancel
Save