public Texture loadTexture(TextureData textureData) { return TextureIO.newTexture(textureData); }
/** * Creates an OpenGL texture object from the specified stream using * the current OpenGL context. * * @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) * @throws IOException if an error occurred while reading the stream * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ public static Texture newTexture(final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException, GLException { final GL gl = GLContext.getCurrentGL(); final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); final Texture texture = newTexture(gl, data); data.flush(); return texture; }
/** * Creates an OpenGL texture object from the specified stream using * the current OpenGL context. * * @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) * @throws IOException if an error occurred while reading the stream * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ public static Texture newTexture(final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException, GLException { final GL gl = GLContext.getCurrentGL(); final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); final Texture texture = newTexture(gl, data); data.flush(); return texture; }
/** * Creates an OpenGL texture object from the specified TextureData * using the current OpenGL context. * * @param data the texture data to turn into an OpenGL texture * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ public static Texture newTexture(final TextureData data) throws GLException, IllegalArgumentException { return newTexture(GLContext.getCurrentGL(), data); }
/** * Creates an OpenGL texture object from the specified file using * the current OpenGL context. * * @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. * @throws IOException if an error occurred while reading the file * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ public static Texture newTexture(final File file, final boolean mipmap) throws IOException, GLException { final GL gl = GLContext.getCurrentGL(); final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); final Texture texture = newTexture(gl, data); data.flush(); return texture; }
public Texture loadTexture(String name) throws GLException, IOException { if (name == null) { return null; } URL textUrl = this.resourceService.resourceToUrl(name); if (textUrl == null) { log.info("No file to load: " + name); return null; } return TextureIO.newTexture(textUrl, true, null); }
/** * Creates an OpenGL texture object from the specified file using * the current OpenGL context. * * @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. * @throws IOException if an error occurred while reading the file * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ public static Texture newTexture(final File file, final boolean mipmap) throws IOException, GLException { final GL gl = GLContext.getCurrentGL(); final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); final Texture texture = newTexture(gl, data); data.flush(); return texture; }
/** * Creates an OpenGL texture object from the specified TextureData * using the current OpenGL context. * * @param data the texture data to turn into an OpenGL texture * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ public static Texture newTexture(final TextureData data) throws GLException, IllegalArgumentException { return newTexture(GLContext.getCurrentGL(), data); }
final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, url, mipmap, fileSuffix); final Texture texture = newTexture(gl, data); data.flush(); return texture;
public Texture loadTextureFile(String name, boolean filter) throws GLException, IOException { if (name == null) { return null; } URL textUrl = resourceService.resourceToUrl(name); if (textUrl == null) { log.info("No file to load: " + name); return null; } return TextureIO.newTexture(textUrl, filter, null); }
final GLProfile glp = gl.getGLProfile(); final TextureData data = newTextureData(glp, url, mipmap, fileSuffix); final Texture texture = newTexture(gl, data); data.flush(); return texture;
private static Texture loadTexture() throws GLException, IOException { InputStream f_stream = null; try { f_stream = ExampleRenderer.class.getResourceAsStream("ground.jpg"); return NullCheck.notNull(TextureIO.newTexture(f_stream, false, ".jpg")); } finally { if (f_stream != null) { f_stream.close(); } } }
static public Texture createTexture(GL2 gl, final InputStream _data) { try (InputStream data = _data) { Texture t = TextureIO.newTexture(data, true, null); t.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR); t.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR); return t; } catch (IOException e) { throw new RuntimeException(e); } }
protected void load(GL gl, String fileName) throws GLException, IOException { texture = TextureIO.newTexture(new File(fileName), useMipMap); if(textureMagnificationFilter!=-1) texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, textureMagnificationFilter); if(textureMinificationFilter!=-1) texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, textureMinificationFilter); }
@Override public boolean run(GLAutoDrawable glad) { try { a[0] = TextureIO.newTexture(handle.getStream(), true, IOUtil.getFileSuffix(handle.getName())); } catch (IOException ex) { } return true; } });
texture = TextureIO.newTexture(textureData); if (mipmap && !texture.isUsingAutoMipmapGeneration()) { mipmap = false; textureData.setMipmap(false); texture = TextureIO.newTexture(textureData);
mipmap, false, false, null, null); Texture tex = TextureIO.newTexture(GL.GL_TEXTURE_2D); tex.updateImage(gl, a);