Merge pull request #570 from TehLeo/master

Integer Texture Support
define_list_fix
empirephoenix 8 years ago committed by GitHub
commit 9856555074
  1. 7
      jme3-core/src/main/java/com/jme3/renderer/Caps.java
  2. 28
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java
  3. 31
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLImageFormats.java
  4. 4
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  5. 28
      jme3-core/src/main/java/com/jme3/texture/Image.java

@ -201,7 +201,12 @@ public enum Caps {
* Supports floating point & half textures (Format.RGB16F)
*/
FloatTexture,
/**
* Supports integer textures
*/
IntegerTexture,
/**
* Supports floating point FBO color buffers (Format.RGB16F)
*/

@ -54,6 +54,34 @@ public interface GL3 extends GL2 {
public static final int GL_TEXTURE_SWIZZLE_B = 0x8E44;
public static final int GL_TEXTURE_SWIZZLE_G = 0x8E43;
public static final int GL_TEXTURE_SWIZZLE_R = 0x8E42;
public static final int GL_R8I = 33329;
public static final int GL_R8UI = 33330;
public static final int GL_R16I = 33331;
public static final int GL_R16UI = 33332;
public static final int GL_R32I = 33333;
public static final int GL_R32UI = 33334;
public static final int GL_RG8I = 33335;
public static final int GL_RG8UI = 33336;
public static final int GL_RG16I = 33337;
public static final int GL_RG16UI = 33338;
public static final int GL_RG32I = 33339;
public static final int GL_RG32UI = 33340;
public static final int GL_RGBA32UI = 36208;
public static final int GL_RGB32UI = 36209;
public static final int GL_RGBA16UI = 36214;
public static final int GL_RGB16UI = 36215;
public static final int GL_RGBA8UI = 36220;
public static final int GL_RGB8UI = 36221;
public static final int GL_RGBA32I = 36226;
public static final int GL_RGB32I = 36227;
public static final int GL_RGBA16I = 36232;
public static final int GL_RGB16I = 36233;
public static final int GL_RGBA8I = 36238;
public static final int GL_RGB8I = 36239;
public static final int GL_RED_INTEGER = 36244;
public static final int GL_RG_INTEGER = 33320;
public static final int GL_RGB_INTEGER = 36248;
public static final int GL_RGBA_INTEGER = 36249;
public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
public void glBindVertexArray(int param1); /// GL3+

@ -233,6 +233,37 @@ public final class GLImageFormats {
formatComp(formatToGL, Format.ETC1, GLExt.GL_ETC1_RGB8_OES, GL.GL_RGB, GL.GL_UNSIGNED_BYTE);
}
// Integer formats
if(caps.contains(Caps.IntegerTexture)) {
format(formatToGL, Format.R8I, GL3.GL_R8I, GL3.GL_RED_INTEGER, GL.GL_BYTE);
format(formatToGL, Format.R8UI, GL3.GL_R8UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_BYTE);
format(formatToGL, Format.R16I, GL3.GL_R16I, GL3.GL_RED_INTEGER, GL.GL_SHORT);
format(formatToGL, Format.R16UI, GL3.GL_R16UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_SHORT);
format(formatToGL, Format.R32I, GL3.GL_R32I, GL3.GL_RED_INTEGER, GL.GL_INT);
format(formatToGL, Format.R32UI, GL3.GL_R32UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_INT);
format(formatToGL, Format.RG8I, GL3.GL_RG8I, GL3.GL_RG_INTEGER, GL.GL_BYTE);
format(formatToGL, Format.RG8UI, GL3.GL_RG8UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_BYTE);
format(formatToGL, Format.RG16I, GL3.GL_RG16I, GL3.GL_RG_INTEGER, GL.GL_SHORT);
format(formatToGL, Format.RG16UI, GL3.GL_RG16UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_SHORT);
format(formatToGL, Format.RG32I, GL3.GL_RG32I, GL3.GL_RG_INTEGER, GL.GL_INT);
format(formatToGL, Format.RG32UI, GL3.GL_RG32UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_INT);
format(formatToGL, Format.RGB8I, GL3.GL_RGB8I, GL3.GL_RGB_INTEGER, GL.GL_BYTE);
format(formatToGL, Format.RGB8UI, GL3.GL_RGB8UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_BYTE);
format(formatToGL, Format.RGB16I, GL3.GL_RGB16I, GL3.GL_RGB_INTEGER, GL.GL_SHORT);
format(formatToGL, Format.RGB16UI, GL3.GL_RGB16UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_SHORT);
format(formatToGL, Format.RGB32I, GL3.GL_RGB32I, GL3.GL_RGB_INTEGER, GL.GL_INT);
format(formatToGL, Format.RGB32UI, GL3.GL_RGB32UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_INT);
format(formatToGL, Format.RGBA8I, GL3.GL_RGBA8I, GL3.GL_RGBA_INTEGER, GL.GL_BYTE);
format(formatToGL, Format.RGBA8UI, GL3.GL_RGBA8UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_BYTE);
format(formatToGL, Format.RGBA16I, GL3.GL_RGBA16I, GL3.GL_RGBA_INTEGER, GL.GL_SHORT);
format(formatToGL, Format.RGBA16UI, GL3.GL_RGBA16UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_SHORT);
format(formatToGL, Format.RGBA32I, GL3.GL_RGBA32I, GL3.GL_RGBA_INTEGER, GL.GL_INT);
format(formatToGL, Format.RGBA32UI, GL3.GL_RGBA32UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_INT);
}
return formatToGL;
}
}

@ -298,6 +298,10 @@ public final class GLRenderer implements Renderer {
if (hasFloatTexture) {
caps.add(Caps.FloatTexture);
}
// integer texture format extensions
if(hasExtension("GL_EXT_texture_integer") || caps.contains(Caps.OpenGL30))
caps.add(Caps.IntegerTexture);
if (hasExtension("GL_OES_depth_texture") || gl2 != null) {
caps.add(Caps.DepthTexture);

@ -299,7 +299,33 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
*
* Requires {@link Caps#TextureCompressionETC1}.
*/
ETC1(4, false, true, false);
ETC1(4, false, true, false),
R8I(8),
R8UI(8),
R16I(16),
R16UI(16),
R32I(32),
R32UI(32),
RG8I(16),
RG8UI(16),
RG16I(32),
RG16UI(32),
RG32I(64),
RG32UI(64),
RGB8I(24),
RGB8UI(24),
RGB16I(48),
RGB16UI(48),
RGB32I(96),
RGB32UI(96),
RGBA8I(32),
RGBA8UI(32),
RGBA16I(64),
RGBA16UI(64),
RGBA32I(128),
RGBA32UI(128)
;
private int bpp;
private boolean isDepth;

Loading…
Cancel
Save