aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLContext.java24
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java52
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java32
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java91
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java50
8 files changed, 39 insertions, 240 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java
index 6576c9f10..606e4b4ed 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java
@@ -1639,7 +1639,7 @@ public abstract class GLContext {
return new VersionNumber(major, minor, 0);
}
- private static void validateProfileBits(final int bits, final String argName) {
+ protected static void validateProfileBits(final int bits, final String argName) {
int num = 0;
if( 0 != ( CTX_PROFILE_COMPAT & bits ) ) { num++; }
if( 0 != ( CTX_PROFILE_CORE & bits ) ) { num++; }
@@ -1700,28 +1700,6 @@ public abstract class GLContext {
return r.intern();
}
- /**
- * @deprecated Use {@link GLContextImpl#mapAvailableGLVersion(AbstractGraphicsDevice, int, int, VersionNumber, int)}
- */
- protected static Integer mapAvailableGLVersion(final AbstractGraphicsDevice device,
- final int reqMajor, final int profile, final int resMajor, final int resMinor, int resCtp)
- {
- validateProfileBits(profile, "profile");
- validateProfileBits(resCtp, "resCtp");
-
- if(FORCE_NO_FBO_SUPPORT) {
- resCtp &= ~CTX_IMPL_FBO ;
- }
- if(DEBUG) {
- System.err.println(getThreadName() + ": createContextARB-MapGLVersions MAP "+device+": "+reqMajor+" ("+GLContext.getGLProfile(new StringBuilder(), profile).toString()+ ") -> "+getGLVersion(resMajor, resMinor, resCtp, null));
- }
- final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, profile);
- final Integer val = Integer.valueOf(composeBits(resMajor, resMinor, resCtp));
- synchronized(deviceVersionAvailable) {
- return deviceVersionAvailable.put( objectKey, val );
- }
- }
-
protected static StringBuilder dumpAvailableGLVersions(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index 7f630f9d5..d24ca5b7e 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -1738,7 +1738,6 @@ public final class FloatUtil {
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
* @param d result a*b in column-major order
- * @deprecated use on of the float[] variants
*/
public static void multMatrix(final FloatBuffer a, final FloatBuffer b, final float[] d) {
final int a_off = a.position();
@@ -1758,7 +1757,6 @@ public final class FloatUtil {
* Multiply matrix: [a] = [a] x [b]
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
- * @deprecated use on of the float[] variants
*/
public static void multMatrix(final FloatBuffer a, final FloatBuffer b) {
final int a_off = a.position();
@@ -1831,7 +1829,6 @@ public final class FloatUtil {
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
* @param v_out m_in * v_in
- * @deprecated use on of the float[] variants
*/
public static void multMatrixVec(final FloatBuffer m_in, final float[] v_in, final float[] v_out) {
final int m_in_off = m_in.position();
@@ -1900,7 +1897,6 @@ public final class FloatUtil {
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
* @param row row number to print
* @return matrix row string representation
- * @deprecated use on of the float[] variants
*/
public static StringBuilder matrixRowToString(StringBuilder sb, final String f,
final FloatBuffer a, final int aOffset,
@@ -1959,7 +1955,6 @@ public final class FloatUtil {
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
* @return matrix string representation
- * @deprecated use on of the float[] variants
*/
public static StringBuilder matrixToString(StringBuilder sb, final String rowPrefix, final String f,
final FloatBuffer a, final int aOffset, final int rows, final int columns, final boolean rowMajorOrder) {
@@ -2012,7 +2007,6 @@ public final class FloatUtil {
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
* @return side by side representation
- * @deprecated use on of the float[] variants
*/
public static StringBuilder matrixToString(StringBuilder sb, final String rowPrefix, final String f,
final FloatBuffer a, final int aOffset, final FloatBuffer b, final int bOffset,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 196acf9ab..5383f91be 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -920,7 +920,6 @@ public final class PMVMatrix implements GLMatrixFunc {
* or {@link #glGetFrustum() Frustum get} methods.
* </p>
*
- * @deprecated Function is exposed for debugging purposes only.
* @see #DIRTY_INVERSE_MODELVIEW
* @see #DIRTY_INVERSE_TRANSPOSED_MODELVIEW
* @see #DIRTY_FRUSTUM
@@ -941,7 +940,6 @@ public final class PMVMatrix implements GLMatrixFunc {
* or {@link #glGetFrustum() Frustum get} methods.
* </p>
*
- * @deprecated Function is exposed for debugging purposes only.
* @see #clearAllUpdateRequests()
* @see #DIRTY_INVERSE_MODELVIEW
* @see #DIRTY_INVERSE_TRANSPOSED_MODELVIEW
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
index e007309e2..2ac7c796d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
@@ -701,9 +701,8 @@ public class TextureIO {
* The last provider added, will be the first provider to be tested.
* </p>
* <p>
- * In case the {@link TextureProvider} also implements {@link TextureProvider.SupportsImageTypes},
- * the {@link TextureProvider} is being mapped to its supporting {@link ImageType}s
- * allowing an O(1) association.
+ * The {@link TextureProvider} is being mapped to its supporting {@link ImageType}s
+ * allowing an O(1) association, if {@link TextureProvider#}
* </p>
*/
public static void addTextureProvider(final TextureProvider provider) {
@@ -712,12 +711,10 @@ public class TextureIO {
// more optimal provider
textureProviders.add(0, provider);
- if( provider instanceof TextureProvider.SupportsImageTypes ) {
- final ImageType[] imageTypes = ((TextureProvider.SupportsImageTypes)provider).getImageTypes();
- if( null != imageTypes ) {
- for(int i=0; i<imageTypes.length; i++) {
- imageType2TextureProvider.put(imageTypes[i], provider);
- }
+ final ImageType[] imageTypes = provider.getImageTypes();
+ if( null != imageTypes ) {
+ for(int i=0; i<imageTypes.length; i++) {
+ imageType2TextureProvider.put(imageTypes[i], provider);
}
}
}
@@ -870,9 +867,8 @@ public class TextureIO {
mipmap,
fileSuffix);
if (data != null) {
- if( provider instanceof TextureProvider.SupportsImageTypes ) {
- data.srcImageType = ((TextureProvider.SupportsImageTypes)provider).getImageTypes()[0];
- }
+ final ImageType[] imageTypes = provider.getImageTypes();
+ data.srcImageType = null != imageTypes ? imageTypes[0] : null;
return data;
}
}
@@ -916,30 +912,8 @@ public class TextureIO {
}
//----------------------------------------------------------------------
- // Base class for internal image providers, only providing stream based data!
- static abstract class StreamBasedTextureProvider implements TextureProvider, TextureProvider.SupportsImageTypes {
- @Override
- public final TextureData newTextureData(final GLProfile glp, final File file,
- final int internalFormat,
- final int pixelFormat,
- final boolean mipmap,
- final String fileSuffix) throws IOException {
- throw new UnsupportedOperationException("Only stream is supported");
- }
-
- @Override
- public final TextureData newTextureData(final GLProfile glp, final URL url,
- final int internalFormat,
- final int pixelFormat,
- final boolean mipmap,
- final String fileSuffix) throws IOException {
- throw new UnsupportedOperationException("Only stream is supported");
- }
- }
-
- //----------------------------------------------------------------------
// DDS image provider
- static class DDSTextureProvider extends StreamBasedTextureProvider {
+ static class DDSTextureProvider implements TextureProvider {
private static final ImageType[] imageTypes = new ImageType[] { new ImageType(ImageType.T_DDS) };
@Override
public final ImageType[] getImageTypes() {
@@ -1048,7 +1022,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// SGI RGB image provider
- static class SGITextureProvider extends StreamBasedTextureProvider {
+ static class SGITextureProvider implements TextureProvider {
private static final ImageType[] imageTypes = new ImageType[] { new ImageType(ImageType.T_SGI_RGB) };
@Override
public final ImageType[] getImageTypes() {
@@ -1091,7 +1065,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) image provider
- static class TGATextureProvider extends StreamBasedTextureProvider {
+ static class TGATextureProvider implements TextureProvider {
private static final ImageType[] imageTypes = new ImageType[] { new ImageType(ImageType.T_TGA) };
@Override
public final ImageType[] getImageTypes() {
@@ -1135,7 +1109,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// PNG image provider
- static class PNGTextureProvider extends StreamBasedTextureProvider {
+ static class PNGTextureProvider implements TextureProvider {
private static final ImageType[] imageTypes = new ImageType[] { new ImageType(ImageType.T_PNG) };
@Override
public final ImageType[] getImageTypes() {
@@ -1182,7 +1156,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// JPEG image provider
- static class JPGTextureProvider extends StreamBasedTextureProvider {
+ static class JPGTextureProvider implements TextureProvider {
private static final ImageType[] imageTypes = new ImageType[] { new ImageType(ImageType.T_JPG) };
@Override
public final ImageType[] getImageTypes() {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
index 6ad9f7cf1..246676aae 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
@@ -237,38 +237,6 @@ public class DDSImage {
return image;
}
- /** Determines from the magic number whether the given InputStream
- points to a DDS image. The given InputStream must return true
- from markSupported() and support a minimum of four bytes of
- read-ahead.
-
- @param in Stream to check
- @return true if input stream is DDS image or false otherwise
- @throws java.io.IOException if an I/O exception occurred
- @deprecated rather call {@link ImageType#getFileSuffix(InputStream)}
- */
- @Deprecated
- public static boolean isDDSImage(InputStream in) throws IOException {
- if (!(in instanceof BufferedInputStream)) {
- in = new BufferedInputStream(in);
- }
- if (!in.markSupported()) {
- throw new IOException("Can not test non-destructively whether given InputStream is a DDS image");
- }
- in.mark(4);
- int magic = 0;
- for (int i = 0; i < 4; i++) {
- final int tmp = in.read();
- if (tmp < 0) {
- in.reset();
- return false;
- }
- magic = ((magic >>> 8) | (tmp << 24));
- }
- in.reset();
- return (magic == MAGIC);
- }
-
/**
* Writes this DDSImage to the specified file name.
* @param filename File name to write to
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
index 1330696d1..47e40e367 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
@@ -191,28 +191,6 @@ public class SGIImage {
return image;
}
- /**
- * Determines from the magic number whether the given InputStream points to
- * an SGI RGB image. The given InputStream must return true from
- * markSupported() and support a minimum of two bytes of read-ahead.
- *
- * @deprecated rather call {@link ImageType#getFileSuffix(InputStream)}
- */
- @Deprecated
- public static boolean isSGIImage(InputStream in) throws IOException {
- if (!(in instanceof BufferedInputStream)) {
- in = new BufferedInputStream(in);
- }
- if (!in.markSupported()) {
- throw new IOException("Can not test non-destructively whether given InputStream is an SGI RGB image");
- }
- final DataInputStream dIn = new DataInputStream(in);
- dIn.mark(4);
- final short magic = dIn.readShort();
- dIn.reset();
- return (magic == MAGIC);
- }
-
/** Returns the width of the image. */
public int getWidth() {
return header.xsize;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
index 5b316a975..485a1b82d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2015 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -39,11 +40,13 @@
package com.jogamp.opengl.util.texture.spi;
-import java.io.*;
-import java.net.*;
+import java.io.IOException;
+import java.io.InputStream;
+
import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.util.texture.ImageType;
+import com.jogamp.opengl.util.texture.TextureData;
-import com.jogamp.opengl.util.texture.*;
/** Plug-in interface to TextureIO to support reading OpenGL textures
from new file formats. For all methods, either internalFormat or
@@ -66,44 +69,12 @@ public interface TextureProvider {
}
/**
- * Produces a TextureData object from a file, or returns null if the
- * file format was not supported by this TextureProvider. Does not
- * do any OpenGL-related work. The resulting TextureData can be
- * converted into an OpenGL texture in a later step.
- *
- * @param glp the OpenGL Profile this texture data should be
- * created for.
- * @param file the file from which to read the texture data
- *
- * @param internalFormat the OpenGL internal format to be used for
- * the texture, or 0 if it should be inferred
- * from the file's contents
- *
- * @param pixelFormat the OpenGL pixel format to be used for
- * the texture, or 0 if it should be inferred
- * from the file's contents
- *
- * @param mipmap whether mipmaps should be produced for this
- * texture either by autogenerating them or
- * reading them from the file. Some file formats
- * support multiple mipmaps in a single file in
- * which case those mipmaps will be used rather
- * than generating them.
- *
- * @param fileSuffix the file suffix to be used as a hint to the
- * provider to more quickly decide whether it
- * can handle the file, or null if the
- * provider should infer the type from the
- * file's contents
- *
- * @throws IOException if an error occurred while reading the file
- * @deprecated Use {@link #newTextureData(GLProfile, InputStream, int, int, boolean, String)
+ * Returns the known supported {@link ImageType}s, or {@code null} if unknown.
+ * <p>
+ * Use case: Mapping of {@link ImageType}s to {@link TextureProvider}.
+ * </p>
*/
- public TextureData newTextureData(GLProfile glp, File file,
- int internalFormat,
- int pixelFormat,
- boolean mipmap,
- String fileSuffix) throws IOException;
+ ImageType[] getImageTypes();
/**
* Produces a TextureData object from a stream, or returns null if
@@ -143,44 +114,4 @@ public interface TextureProvider {
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException;
-
- /**
- * Produces a TextureData object from a URL, or returns null if the
- * file format was not supported by this TextureProvider. Does not
- * do any OpenGL-related work. The resulting TextureData can be
- * converted into an OpenGL texture in a later step.
- *
- * @param glp the OpenGL Profile this texture data should be
- * created for.
- * @param url the URL from which to read the texture data
- *
- * @param internalFormat the OpenGL internal format to be used for
- * the texture, or 0 if it should be inferred
- * from the file's contents
- *
- * @param pixelFormat the OpenGL pixel format to be used for
- * the texture, or 0 if it should be inferred
- * from the file's contents
- *
- * @param mipmap whether mipmaps should be produced for this
- * texture either by autogenerating them or
- * reading them from the file. Some file formats
- * support multiple mipmaps in a single file in
- * which case those mipmaps will be used rather
- * than generating them.
- *
- * @param fileSuffix the file suffix to be used as a hint to the
- * provider to more quickly decide whether it
- * can handle the file, or null if the
- * provider should infer the type from the
- * file's contents
- *
- * @throws IOException if an error occurred while reading the URL
- * @deprecated Use {@link #newTextureData(GLProfile, InputStream, int, int, boolean, String)
- */
- public TextureData newTextureData(GLProfile glp, URL url,
- int internalFormat,
- int pixelFormat,
- boolean mipmap,
- String fileSuffix) throws IOException;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
index 5072c8c8f..8ee54899c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2015 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -36,38 +37,29 @@
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-
+//
package com.jogamp.opengl.util.texture.spi.awt;
-import java.awt.image.*;
-import java.io.*;
-import java.net.*;
-import javax.imageio.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.imageio.ImageIO;
+
import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.util.texture.ImageType;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.awt.AWTTextureData;
+import com.jogamp.opengl.util.texture.spi.TextureProvider;
import jogamp.opengl.Debug;
-import com.jogamp.opengl.util.texture.*;
-import com.jogamp.opengl.util.texture.awt.*;
-import com.jogamp.opengl.util.texture.spi.*;
public class IIOTextureProvider implements TextureProvider {
private static final boolean DEBUG = Debug.debug("TextureIO");
@Override
- public TextureData newTextureData(final GLProfile glp, final File file,
- final int internalFormat,
- final int pixelFormat,
- final boolean mipmap,
- final String fileSuffix) throws IOException {
- final BufferedImage img = ImageIO.read(file);
- if (img == null) {
- return null;
- }
- if (DEBUG) {
- System.out.println("TextureIO.newTextureData(): BufferedImage type for " + file + " = " +
- img.getType());
- }
- return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
+ public final ImageType[] getImageTypes() {
+ return null;
}
@Override
@@ -86,18 +78,4 @@ public class IIOTextureProvider implements TextureProvider {
}
return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
}
-
- @Override
- public TextureData newTextureData(final GLProfile glp, final URL url,
- final int internalFormat,
- final int pixelFormat,
- final boolean mipmap,
- final String fileSuffix) throws IOException {
- final InputStream stream = url.openStream();
- try {
- return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
- } finally {
- stream.close();
- }
- }
}