Thanks! I got it working by writing my own renderer based on the MapItemRenderer.
For future refence, here's (a slightly modified version of) my code.
package panoramakit.gui;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
/**
* Takes care of loading and drawing previews to the screen.
* @author dayanto
*/
public class PreviewRenderer
{
private File file;
private BufferedImage image;
private DynamicTexture previewTexture;
private ResourceLocation resourceLocation;
private TextureManager textureManager;
public PreviewRenderer(TextureManager textureManager, File file)
{
this.textureManager = textureManager;
this.file = file;
}
/**
* Attempts to load the image. Returns whether it was successful or not.
*/
public boolean loadPreview()
{
try {
image = ImageIO.read(file);
previewTexture = new DynamicTexture(image);
resourceLocation = textureManager.getDynamicTextureLocation("preivew", previewTexture);
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
public void drawCenteredImage(int xPos, int yPos, int width, int height)
{
if(previewTexture == null) {
boolean successful = loadPreview();
if(!successful) return;
}
drawImage(xPos + (width - image.getWidth()) / 2, yPos + (height - image.getHeight()) / 2, image.getWidth(), image.getHeight());
}
private void drawImage(int xPos, int yPos, int width, int height)
{
previewTexture.updateDynamicTexture();
Tessellator tessellator = Tessellator.instance;
textureManager.bindTexture(resourceLocation);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(xPos , yPos + height, 0, 0.0, 1.0);
tessellator.addVertexWithUV(xPos + width, yPos + height, 0, 1.0, 1.0);
tessellator.addVertexWithUV(xPos + width, yPos , 0, 1.0, 0.0);
tessellator.addVertexWithUV(xPos , yPos , 0, 0.0, 0.0);
tessellator.draw();
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
}
}