当前位置: 首页>>代码示例>>Java>>正文


Java SGL.GL_NEAREST属性代码示例

本文整理汇总了Java中org.newdawn.slick.opengl.renderer.SGL.GL_NEAREST属性的典型用法代码示例。如果您正苦于以下问题:Java SGL.GL_NEAREST属性的具体用法?Java SGL.GL_NEAREST怎么用?Java SGL.GL_NEAREST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.newdawn.slick.opengl.renderer.SGL的用法示例。


在下文中一共展示了SGL.GL_NEAREST属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Image

/**
 * 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);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:29,代码来源:Image.java

示例2: load

/**
 * 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);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:Image.java

示例3: setFilter

/**
 * 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); 
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:Image.java


注:本文中的org.newdawn.slick.opengl.renderer.SGL.GL_NEAREST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。