org.newdawn.slick.opengl.pbuffer.GraphicsFactory Java Examples

The following examples show how to use org.newdawn.slick.opengl.pbuffer.GraphicsFactory. 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 5 votes vote down vote up
/**
 * Destroy the image and release any native resources. 
 * Calls on a destroyed image have undefined results
 * 
 * @throws SlickException Indicates a failure to release resources on the graphics card
 */
public void destroy() throws SlickException {
	if (isDestroyed()) {
		return;
	}
	flushPixelData();
	destroyed = true;
	texture.release();
	GraphicsFactory.releaseGraphicsForImage(this);
}
 
Example #2
Source File: Image.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Destroy the image and release any native resources. 
 * Calls on a destroyed image have undefined results
 * 
 * @throws SlickException Indicates a failure to release resources on the graphics card
 */
public void destroy() throws SlickException {
	if (isDestroyed()) {
		return;
	}
	flushPixelData();
	destroyed = true;
	texture.release();
	GraphicsFactory.releaseGraphicsForImage(this);
}
 
Example #3
Source File: Image.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Destroy the image and release any native resources. 
 * Calls on a destroyed image have undefined results
 * 
 * @throws SlickException Indicates a failure to release resources on the graphics card
 */
public void destroy() throws SlickException {
	if (isDestroyed()) {
		return;
	}
	
	destroyed = true;
	texture.release();
	GraphicsFactory.releaseGraphicsForImage(this);
}
 
Example #4
Source File: ImageGraphicsTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	testImage = new Image("testdata/logo.png");
	preloaded = new Image("testdata/logo.png");
	testFont = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png");
	target = new Image(400,300);
	cut = new Image(100,100);
	gTarget = target.getGraphics();
	offscreenPreload = preloaded.getGraphics();
	
	offscreenPreload.drawString("Drawing over a loaded image", 5, 15);
	offscreenPreload.setLineWidth(5);
	offscreenPreload.setAntiAlias(true);
	offscreenPreload.setColor(Color.blue.brighter());
	offscreenPreload.drawOval(200, 30, 50, 50);
	offscreenPreload.setColor(Color.white);
	offscreenPreload.drawRect(190,20,70,70);
	offscreenPreload.flush();
	
	if (GraphicsFactory.usingFBO()) {
		using = "FBO (Frame Buffer Objects)";
	} else if (GraphicsFactory.usingPBuffer()) {
		using = "Pbuffer (Pixel Buffers)";
	}
	
	System.out.println(preloaded.getColor(50,50));
}
 
Example #5
Source File: ImageGraphicsTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Entry point to our test
 * 
 * @param argv The arguments to pass into the test
 */
public static void main(String[] argv) {
	try {
		GraphicsFactory.setUseFBO(false);
		
		AppGameContainer container = new AppGameContainer(new ImageGraphicsTest());
		container.setDisplayMode(800,600,false);
		container.start();
	} catch (SlickException e) {
		e.printStackTrace();
	}
}
 
Example #6
Source File: Image.java    From opsu-dance with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Get a graphics context that can be used to draw to this image
 * 
 * @return The graphics context used to render to this image
 * @throws SlickException Indicates a failure to create a graphics context
 */
public Graphics getGraphics() throws SlickException {
	return GraphicsFactory.getGraphicsForImage(this);
}
 
Example #7
Source File: Image.java    From opsu with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Get a graphics context that can be used to draw to this image
 * 
 * @return The graphics context used to render to this image
 * @throws SlickException Indicates a failure to create a graphics context
 */
public Graphics getGraphics() throws SlickException {
	return GraphicsFactory.getGraphicsForImage(this);
}
 
Example #8
Source File: Image.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Get a graphics context that can be used to draw to this image
 * 
 * @return The graphics context used to render to this image
 * @throws SlickException Indicates a failure to create a graphics context
 */
public Graphics getGraphics() throws SlickException {
	return GraphicsFactory.getGraphicsForImage(this);
}