/** * Creates a TextureData from the given stream. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param stream the stream from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the stream, or null if none of the * registered texture providers could read the stream * @throws IOException if an error occurred while reading the stream */ public static TextureData newTextureData(final GLProfile glp, final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException { return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix); }
/** * Creates a TextureData from the given stream. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param stream the stream from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the stream, or null if none of the * registered texture providers could read the stream * @throws IOException if an error occurred while reading the stream */ public static TextureData newTextureData(final GLProfile glp, final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException { return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix); }
return newTextureDataImpl(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
return newTextureDataImpl(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
private static TextureData newTextureDataImpl(final GLProfile glp, final URL url, final int internalFormat, final int pixelFormat, final boolean mipmap, final String fileSuffix) throws IOException { if (url == null) { throw new IOException("URL was null"); } final InputStream stream = new BufferedInputStream(url.openStream()); try { return newTextureDataImpl(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } catch(final IOException ioe) { throw new IOException(ioe.getMessage()+", given URL "+url, ioe); } finally { stream.close(); } }
private static TextureData newTextureDataImpl(final GLProfile glp, final File file, final int internalFormat, final int pixelFormat, final boolean mipmap, final String fileSuffix) throws IOException { if (file == null) { throw new IOException("File was null"); } final InputStream stream = new BufferedInputStream(new FileInputStream(file)); try { return newTextureDataImpl( glp, stream, internalFormat, pixelFormat, mipmap, (fileSuffix != null) ? fileSuffix : IOUtil.getFileSuffix(file) ); } catch(final IOException ioe) { throw new IOException(ioe.getMessage()+", given file "+file.getAbsolutePath(), ioe); } finally { stream.close(); } } private static TextureData newTextureDataImpl(final GLProfile glp, final URL url,
/** * Creates a TextureData from the given URL. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param url the URL from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the URL, or null if none of the * registered texture providers could read the URL * @throws IOException if an error occurred while reading the URL */ public static TextureData newTextureData(final GLProfile glp, final URL url, final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); } return newTextureDataImpl(glp, url, 0, 0, mipmap, fileSuffix); }
/** * Creates a TextureData from the given file. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param file the file from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the file, or null if none of the * registered texture providers could read the file * @throws IOException if an error occurred while reading the file */ public static TextureData newTextureData(final GLProfile glp, final File file, final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(file); } return newTextureDataImpl(glp, file, 0, 0, mipmap, fileSuffix); }
/** * Creates a TextureData from the given file. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param file the file from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the file, or null if none of the * registered texture providers could read the file * @throws IOException if an error occurred while reading the file */ public static TextureData newTextureData(final GLProfile glp, final File file, final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(file); } return newTextureDataImpl(glp, file, 0, 0, mipmap, fileSuffix); }
/** * Creates a TextureData from the given URL. Does no OpenGL work. * * @param glp the OpenGL Profile this texture data should be * created for. * @param url the URL from which to read the texture data * @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 suffix of the file name to be used as a * hint of the file format to the underlying * texture provider, or null if none and should be * auto-detected (some texture providers do not * support this) * @return the texture data from the URL, or null if none of the * registered texture providers could read the URL * @throws IOException if an error occurred while reading the URL */ public static TextureData newTextureData(final GLProfile glp, final URL url, final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); } return newTextureDataImpl(glp, url, 0, 0, mipmap, fileSuffix); }
return newTextureDataImpl(glp, url, internalFormat, pixelFormat, mipmap, fileSuffix);
return newTextureDataImpl(glp, url, internalFormat, pixelFormat, mipmap, fileSuffix);
return newTextureDataImpl(glp, file, internalFormat, pixelFormat, mipmap, fileSuffix);
return newTextureDataImpl(glp, file, internalFormat, pixelFormat, mipmap, fileSuffix);