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


Java InternalTextureLoader类代码示例

本文整理汇总了Java中org.newdawn.slick.opengl.InternalTextureLoader的典型用法代码示例。如果您正苦于以下问题:Java InternalTextureLoader类的具体用法?Java InternalTextureLoader怎么用?Java InternalTextureLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Image

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * 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,代码行数:30,代码来源:Image.java

示例2: load

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * 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,代码行数:29,代码来源:Image.java

示例3: init

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
	try {
		Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());
		
		final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
		pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

		// Initialise state of the pbuffer context.
		pbuffer.makeCurrent();

		initGL();
		GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
		pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
		image.draw(0,0);
		image.setTexture(tex);
		
		Display.makeCurrent();
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:PBufferGraphics.java

示例4: init

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
	try {
		Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

		pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
		// Initialise state of the pbuffer context.
		pbuffer.makeCurrent();

		initGL();
		image.draw(0,0);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
		GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
							  tex.getTextureWidth(), 
							  tex.getTextureHeight(), 0);
		image.setTexture(tex);
		
		Display.makeCurrent();
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:PBufferUniqueGraphics.java

示例5: setFilter

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Set the image filtering to be used. This will cause the image
 * to be reloaded. 
 * 
 * @param f The filtering mode to use
 * @throws SlickException Indicates a failure to revalidate the image source
 */
public void setFilter(int f) throws SlickException {
	this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST;
	
	try {
		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:CyboticCatfish,项目名称:code404,代码行数:25,代码来源:Image.java

示例6: Image

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * 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, @Nullable Color transparent) throws SlickException {
    this.filter = f;
    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:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:27,代码来源:Image.java

示例7: load

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * 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(@Nonnull InputStream in, String ref, boolean flipped, int f, @Nullable Color transparent) throws SlickException {
    this.filter = f;

    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:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:29,代码来源:Image.java

示例8: init

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Initialise the PBuffer that will be used to render to
 *
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);

        if (image.getTexture()!=null)
            image.draw(0,0);
        Graphics.setCurrent(this); //this means you need to call flush() after getGraphics()
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:31,代码来源:PBufferGraphics.java

示例9: init

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Initialise the PBuffer that will be used to render to
 *
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        if (image.getTexture()!=null) {
            image.draw(0,0);
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
            GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0,
                                  tex.getTextureWidth(),
                                  tex.getTextureHeight(), 0);
        }
        Graphics.setCurrent(this); //this means you need to call flush() after getGraphics
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:31,代码来源:PBufferUniqueGraphics.java

示例10: VisorOpenGl

import org.newdawn.slick.opengl.InternalTextureLoader; //导入依赖的package包/类
/**
 * Inicia el Visor OpenGL indicando la instancia de partido, las dimensiones
 * de la pantalla (sx,sy), si Se ejecuta en pantalla completa(fullscreen), e
 * indicando la instancia del jframe Principal(dejar nulo)
 * 
 * @param partido
 * @param sx
 * @param sy
 * @param fullscreen
 * @param principal
 * @throws SlickException
 */
public VisorOpenGl(Partido partido, int sx, int sy, boolean fullscreen,
		PrincipalFrame principal) throws SlickException {
	this.partido = partido;
	this.sx = sx;
	this.sy = sy;
	this.dxsaque = (sx + 300 * 2) / 75;
	sx2 = sx / 2;
	sy2 = sy / 2;
	this.principal = principal;
	AppGameContainer container = new AppGameContainer(this);
	container.setForceExit(false);
	container.setDisplayMode(sx, sy, fullscreen);
	container.start();
	SoundStore.get().clear();
	InternalTextureLoader.get().clear();
}
 
开发者ID:alfonsodou,项目名称:javaleagueframework,代码行数:29,代码来源:VisorOpenGl.java


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