private int loadTexture(String root, String fileName)
	{
		if(!root.endsWith("/"))
			root.concat("/");
		
		String path = (root.length() <=1 ? Texture.root : root) + fileName;
		
		try
		{		
			CobaltUtil.log("Loading Texture: " + fileName);
			
			BufferedImage bimg = null;
			
			try{
				bimg = ImageIO.read(new FileInputStream(new File(path)));
			}
			catch(IOException e)
			{
				e.printStackTrace();
				CobaltUtil.logError("Unable to load texture:" + path);
				System.exit(1);
			}
			
			this.width = bimg.getWidth();
			this.height = bimg.getHeight();
			
			int textureID = glGenTextures();
			
			int[] pixels = new int[width * height * 4];
			bimg.getRGB(0, 0, width, height, pixels, 0, width);
			
			ByteBuffer buffer = BufferUtils.createByteBuffer(pixels.length);
			
			for(int y = 0; y < height; y++)
			{
				for(int x = 0; x < width; x++)
				{
					int pixel = pixels[y * width + 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, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
			
			return textureID;
		}
		catch(Exception e)
		{
			e.printStackTrace();
			System.exit(1);
		}
		
		return 0;
	}