Java Code Examples for org.newdawn.slick.opengl.renderer.SGL#GL_NEAREST
The following examples show how to use
org.newdawn.slick.opengl.renderer.SGL#GL_NEAREST .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Image.java From opsu-dance with GNU General Public License v3.0 | 6 votes |
/** * Create an image based on a file at the specified location * * @param ref The location of the image file to load * @param flipped True if the image should be flipped on the y-axis on load * @param f The filtering method to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ public Image(String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; this.transparent = transparent; this.flipped = flipped; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 2
Source File: Image.java From opsu-dance with GNU General Public License v3.0 | 6 votes |
/** * Load the image * * @param in The input stream to read the image from * @param ref The name that should be assigned to the image * @param flipped True if the image should be flipped on the y-axis on load * @param f The filter to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(in, ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 3
Source File: Image.java From opsu with GNU General Public License v3.0 | 6 votes |
/** * Create an image based on a file at the specified location * * @param ref The location of the image file to load * @param flipped True if the image should be flipped on the y-axis on load * @param f The filtering method to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ public Image(String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; this.transparent = transparent; this.flipped = flipped; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 4
Source File: Image.java From opsu with GNU General Public License v3.0 | 6 votes |
/** * Load the image * * @param in The input stream to read the image from * @param ref The name that should be assigned to the image * @param flipped True if the image should be flipped on the y-axis on load * @param f The filter to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(in, ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 5
Source File: Image.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Create an image based on a file at the specified location * * @param ref The location of the image file to load * @param flipped True if the image should be flipped on the y-axis on load * @param f The filtering method to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ public Image(String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; this.transparent = transparent; this.flipped = flipped; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 6
Source File: Image.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Load the image * * @param in The input stream to read the image from * @param ref The name that should be assigned to the image * @param flipped True if the image should be flipped on the y-axis on load * @param f The filter to use when scaling this image * @param transparent The color to treat as transparent * @throws SlickException Indicates a failure to load the image */ private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (transparent.r * 255); trans[1] = (int) (transparent.g * 255); trans[2] = (int) (transparent.b * 255); } texture = InternalTextureLoader.get().getTexture(in, ref, flipped, filter, trans); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to load image from: "+ref, e); } }
Example 7
Source File: Image.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
/** * Set the image filtering to be used. Note that this will also affect any * image that was derived from this one (i.e. sub-images etc) * * @param f The filtering mode to use */ public void setFilter(int f) { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture.bind(); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MIN_FILTER, filter); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MAG_FILTER, filter); }
Example 8
Source File: Image.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
/** * Create an empty image * * @param width The width of the image * @param height The height of the image * @param f The filter to apply to scaling the new image * @throws SlickException Indicates a failure to create the underlying resource */ public Image(int width, int height, int f) throws SlickException { ref = super.toString(); this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { texture = InternalTextureLoader.get().createTexture(width, height, this.filter); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to create empty image "+width+"x"+height); } init(); }
Example 9
Source File: Image.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
/** * Create an image from a image data source. Note that this method uses * * @param data The pixelData to use to create the image * @param f The filter to use when scaling this image */ public Image(ImageData data, int f) { try { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture = InternalTextureLoader.get().getTexture(data, this.filter); ref = texture.toString(); } catch (IOException e) { Log.error(e); } }
Example 10
Source File: Image.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * Set the image filtering to be used. Note that this will also affect any * image that was derived from this one (i.e. sub-images etc) * * @param f The filtering mode to use */ public void setFilter(int f) { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture.bind(); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MIN_FILTER, filter); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MAG_FILTER, filter); }
Example 11
Source File: Image.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * Create an empty image * * @param width The width of the image * @param height The height of the image * @param f The filter to apply to scaling the new image * @throws SlickException Indicates a failure to create the underlying resource */ public Image(int width, int height, int f) throws SlickException { ref = super.toString(); this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { texture = InternalTextureLoader.get().createTexture(width, height, this.filter); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to create empty image "+width+"x"+height); } init(); }
Example 12
Source File: Image.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * Create an image from a image data source. Note that this method uses * * @param data The pixelData to use to create the image * @param f The filter to use when scaling this image */ public Image(ImageData data, int f) { try { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture = InternalTextureLoader.get().getTexture(data, this.filter); ref = texture.toString(); } catch (IOException e) { Log.error(e); } }
Example 13
Source File: Image.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Set the image filtering to be used. Note that this will also affect any * image that was derived from this one (i.e. sub-images etc) * * @param f The filtering mode to use */ public void setFilter(int f) { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture.bind(); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MIN_FILTER, filter); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MAG_FILTER, filter); }
Example 14
Source File: Image.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create an empty image * * @param width The width of the image * @param height The height of the image * @param f The filter to apply to scaling the new image * @throws SlickException Indicates a failure to create the underlying resource */ public Image(int width, int height, int f) throws SlickException { ref = super.toString(); this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { texture = InternalTextureLoader.get().createTexture(width, height, this.filter); } catch (IOException e) { Log.error(e); throw new SlickException("Failed to create empty image "+width+"x"+height); } init(); }
Example 15
Source File: Image.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create an image from a image data source. Note that this method uses * * @param data The pixelData to use to create the image * @param f The filter to use when scaling this image */ public Image(ImageData data, int f) { try { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; texture = InternalTextureLoader.get().getTexture(data, this.filter); ref = texture.toString(); } catch (IOException e) { Log.error(e); } }