public static Texture loadTexture(String name)
	{
		BufferedImage bimg = null;

		try {
			bimg = ImageIO.read(Texture.class.getClassLoader().getResourceAsStream(name));
		} catch(IOException e) {
			e.printStackTrace();
			System.err.println("Unable to load Texture: " + name);
			Game.end();
		}

		int textureID = glGenTextures();

		int[] pixels = new int[bimg.getWidth() * bimg.getHeight() * 4];
		bimg.getRGB(0, 0, bimg.getWidth(), bimg.getHeight(), pixels, 0, bimg.getWidth());

		ByteBuffer buffer = BufferUtils.createByteBuffer(pixels.length);

		for (int y = 0; y < bimg.getHeight(); y++)
		{
			for (int x = 0; x < bimg.getWidth(); x++)
			{
				int pixel = pixels[y * bimg.getWidth() + x];
				buffer.put((byte) ((pixel >> 16) & 0xFF));
				buffer.put((byte) ((pixel >> 8) & 0xFF));
				buffer.put((byte) ((pixel) & 0xFF));
				buffer.put((byte) ((pixel >> 24) & 0xFF));
			}
		}

		buffer.flip();

		glBindTexture(GL_TEXTURE_2D, textureID);
		
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, bimg.getWidth(), bimg.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

		return new Texture(textureID, bimg.getWidth(), bimg.getHeight());
	}