code: public TextureImpl getTexture(InputStream in, String resourceName, boolean flipped, int filter, int[] transparent) throws IOException {
      	if (deferred) {
  	    	return new DeferredTexture(in, resourceName, flipped, filter, transparent);
  	    }
      	
      	HashMap hash = texturesLinear;
          if (filter == SGL.GL_NEAREST) {
          	hash = texturesNearest;
          }
          
          String resName = resourceName;
          if (transparent != null) {
          	resName += ":"+transparent[0]+":"+transparent[1]+":"+transparent[2];
          }
          resName += ":"+flipped;
          
          if (holdTextureData) {
          	TextureImpl tex = (TextureImpl)  hash.get(resName);
          	if (tex != null) {
          		return tex;
          	}
          } else {
  	    	SoftReference ref = (SoftReference) hash.get(resName);
  	    	if (ref != null) {
  		    	TextureImpl tex = (TextureImpl) ref.get();
  		        if (tex != null) {
  		        	return tex;
  		        } else {
  		        	hash.remove(resName);
  		        }
  	    	}
          }
          
          // horrible test until I can find something more suitable
          try {
          	GL.glGetError();
          } catch (NullPointerException e) {
          	throw new RuntimeException("Image based resources must be loaded as part of init() or the game loop. They cannot be loaded before initialisation.");
          }
          
          TextureImpl tex = getTexture(in, resourceName,
                           SGL.GL_TEXTURE_2D, 
                           filter, 
                           filter, flipped, transparent);
          
          tex.setCacheName(resName);
          if (holdTextureData) {
          	hash.put(resName, tex);
          } else {
          	hash.put(resName, new SoftReference(tex));
          }
          
          return tex;
      }
docs: Get a texture from a image file
  
  @param in The stream from which we can load the image
  @param resourceName The name to give this image in the internal cache
  @param flipped True if we should flip the image on the y-axis while loading
  @param filter The filter to use when scaling the texture
  @param transparent The colour to interpret as transparent or null if none
  @return The texture loaded
  @throws IOException Indicates a failure to load the image