formatSwiz(formatToGL, Format.Alpha8, GL3.GL_R8, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance8, GL3.GL_R8, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance8Alpha8, GL3.GL_RG8, GL3.GL_RG, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance16F, GL3.GL_R16F, GL.GL_RED, halfFloatFormat); formatSwiz(formatToGL, Format.Luminance32F, GL3.GL_R32F, GL.GL_RED, GL.GL_FLOAT); formatSwiz(formatToGL, Format.Luminance16FAlpha16F, GL3.GL_RG16F, GL3.GL_RG, halfFloatFormat); formatSrgbSwiz(formatToGL, Format.Luminance8, GLExt.GL_SRGB8_EXT, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSrgbSwiz(formatToGL, Format.Luminance8Alpha8, GLExt.GL_SRGB8_ALPHA8_EXT, GL3.GL_RG, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Alpha8, GL2.GL_ALPHA8, GL.GL_ALPHA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Luminance8, GL2.GL_LUMINANCE8, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Luminance8Alpha8, GL2.GL_LUMINANCE8_ALPHA8, GL.GL_LUMINANCE_ALPHA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGB8, GL2.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGBA8, GLExt.GL_RGBA8, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGB565, GL2.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_SHORT_5_6_5); format(formatToGL, Format.BGR8, GL2.GL_RGB8, GL2.GL_BGR, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.ARGB8, GLExt.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8); format(formatToGL, Format.BGRA8, GLExt.GL_RGBA8, GL2.GL_BGRA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.ABGR8, GLExt.GL_RGBA8, GL.GL_RGBA, GL2.GL_UNSIGNED_INT_8_8_8_8); formatSrgb(formatToGL, Format.RGB8, GLExt.GL_SRGB8_EXT, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); formatSrgb(formatToGL, Format.RGB565, GLExt.GL_SRGB8_EXT, GL.GL_RGB, GL.GL_UNSIGNED_SHORT_5_6_5); formatSrgb(formatToGL, Format.RGB5A1, GLExt.GL_SRGB8_ALPHA8_EXT, GL.GL_RGBA, GL.GL_UNSIGNED_SHORT_5_5_5_1); formatSrgb(formatToGL, Format.RGBA8, GLExt.GL_SRGB8_ALPHA8_EXT, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); if (!caps.contains(Caps.CoreProfile)) { formatSrgb(formatToGL, Format.Luminance8, GLExt.GL_SLUMINANCE8_EXT, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE);
/** * get the glformat from JME image Format * @param format * @return */ private GLImageFormat getGlFormat(Image.Format format) { EnumSet<Caps> caps = EnumSet.allOf(Caps.class); GLImageFormat[][] formats = GLImageFormats.getFormatsForCaps(caps); return formats[0][format.ordinal()]; }
formatSwiz(formatToGL, Format.Alpha8, GL3.GL_R8, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance8, GL3.GL_R8, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance8Alpha8, GL3.GL_RG8, GL3.GL_RG, GL.GL_UNSIGNED_BYTE); formatSwiz(formatToGL, Format.Luminance16F, GL3.GL_R16F, GL.GL_RED, halfFloatFormat); formatSwiz(formatToGL, Format.Luminance32F, GL3.GL_R32F, GL.GL_RED, GL.GL_FLOAT); formatSwiz(formatToGL, Format.Luminance16FAlpha16F, GL3.GL_RG16F, GL3.GL_RG, halfFloatFormat); formatSrgbSwiz(formatToGL, Format.Luminance8, GLExt.GL_SRGB8_EXT, GL.GL_RED, GL.GL_UNSIGNED_BYTE); formatSrgbSwiz(formatToGL, Format.Luminance8Alpha8, GLExt.GL_SRGB8_ALPHA8_EXT, GL3.GL_RG, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Alpha8, GL2.GL_ALPHA8, GL.GL_ALPHA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Luminance8, GL2.GL_LUMINANCE8, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.Luminance8Alpha8, GL2.GL_LUMINANCE8_ALPHA8, GL.GL_LUMINANCE_ALPHA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGB8, GL2.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGBA8, GLExt.GL_RGBA8, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.RGB565, GL2.GL_RGB8, GL.GL_RGB, GL.GL_UNSIGNED_SHORT_5_6_5); format(formatToGL, Format.BGR8, GL2.GL_RGB8, GL2.GL_BGR, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.ARGB8, GLExt.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8); format(formatToGL, Format.BGRA8, GLExt.GL_RGBA8, GL2.GL_BGRA, GL.GL_UNSIGNED_BYTE); format(formatToGL, Format.ABGR8, GLExt.GL_RGBA8, GL.GL_RGBA, GL2.GL_UNSIGNED_INT_8_8_8_8); formatSrgb(formatToGL, Format.RGB8, GLExt.GL_SRGB8_EXT, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); formatSrgb(formatToGL, Format.RGB565, GLExt.GL_SRGB8_EXT, GL.GL_RGB, GL.GL_UNSIGNED_SHORT_5_6_5); formatSrgb(formatToGL, Format.RGB5A1, GLExt.GL_SRGB8_ALPHA8_EXT, GL.GL_RGBA, GL.GL_UNSIGNED_SHORT_5_5_5_1); formatSrgb(formatToGL, Format.RGBA8, GLExt.GL_SRGB8_ALPHA8_EXT, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); if (!caps.contains(Caps.CoreProfile)) { formatSrgb(formatToGL, Format.Luminance8, GLExt.GL_SLUMINANCE8_EXT, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE);
/** * returns the JME image format from gl formats and types. * @param glFormat * @param glInternalFormat * @param glType * @return */ private Image.Format getImageFormat(int glFormat, int glInternalFormat, int glType) { EnumSet<Caps> caps = EnumSet.allOf(Caps.class); GLImageFormat[][] formats = GLImageFormats.getFormatsForCaps(caps); for (GLImageFormat[] format : formats) { for (int j = 0; j < format.length; j++) { GLImageFormat glImgFormat = format[j]; if (glImgFormat != null) { if (glImgFormat.format == glFormat && glImgFormat.dataType == glType) { if (glFormat == glInternalFormat || glImgFormat.internalFormat == glInternalFormat) { return Image.Format.values()[j]; } } } } } return null; }
public void initialize(EnumSet<Caps> caps) { this.formats = GLImageFormats.getFormatsForCaps(caps); if (logger.isLoggable(Level.FINE)) { StringBuilder sb = new StringBuilder(); sb.append("Supported texture formats: \n"); for (int i = 0; i < Format.values().length; i++) { Format format = Format.values()[i]; if (formats[0][i] != null) { boolean srgb = formats[1][i] != null; sb.append("\t").append(format.toString()); sb.append(" (Linear"); if (srgb) sb.append("/sRGB"); sb.append(")\n"); } } logger.log(Level.FINE, sb.toString()); } }
/** * get the glformat from JME image Format * @param format * @return */ private GLImageFormat getGlFormat(Image.Format format) { EnumSet<Caps> caps = EnumSet.allOf(Caps.class); GLImageFormat[][] formats = GLImageFormats.getFormatsForCaps(caps); return formats[0][format.ordinal()]; }
/** * returns the JME image format from gl formats and types. * @param glFormat * @param glInternalFormat * @param glType * @return */ private Image.Format getImageFormat(int glFormat, int glInternalFormat, int glType) { EnumSet<Caps> caps = EnumSet.allOf(Caps.class); GLImageFormat[][] formats = GLImageFormats.getFormatsForCaps(caps); for (GLImageFormat[] format : formats) { for (int j = 0; j < format.length; j++) { GLImageFormat glImgFormat = format[j]; if (glImgFormat != null) { if (glImgFormat.format == glFormat && glImgFormat.dataType == glType) { if (glFormat == glInternalFormat || glImgFormat.internalFormat == glInternalFormat) { return Image.Format.values()[j]; } } } } } return null; }
public void initialize(EnumSet<Caps> caps) { this.formats = GLImageFormats.getFormatsForCaps(caps); if (logger.isLoggable(Level.FINE)) { StringBuilder sb = new StringBuilder(); sb.append("Supported texture formats: \n"); for (int i = 0; i < Format.values().length; i++) { Format format = Format.values()[i]; if (formats[0][i] != null) { boolean srgb = formats[1][i] != null; sb.append("\t").append(format.toString()); sb.append(" (Linear"); if (srgb) sb.append("/sRGB"); sb.append(")\n"); } } logger.log(Level.FINE, sb.toString()); } }