I have been trying to draw a transparent texture in LWJGL. However, the code I have doesn't seem to work. Whenever I run the code, the transparent image appears but the background is completely black.
Here's what I mean by completely black, but the image is fine:

I have been able to draw non-transparent textures, but so far I've had no luck with drawing this one correctly.
I would like to know what is missing/incorrect in this code.
Code for drawing texture:
//draw transparent texture
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glPushMatrix();
GL11.glColor4d(1,1,1,1);
texture.bind();
GL11.glTranslated(0.5,0.5,0.0);
GL11.glRotated(270-this.getAngle(),0.0,0.0,1.0);
GL11.glTranslated(-0.5,-0.5,0.0);
GL11.glBegin(GL11.GL_QUADS);
{
GL11.glTexCoord2f(0,0);
GL11.glVertex2d(this.getX(), this.getY());
GL11.glTexCoord2f(1,0);
GL11.glVertex2d(this.getX(),(this.getY()+this.getHeight()));
GL11.glTexCoord2f(1,1);
GL11.glVertex2d((this.getX()+this.getWidth()),(this.getY()+this.getHeight()));
GL11.glTexCoord2f(0,1);
GL11.glVertex2d((this.getX()+this.getWidth()), this.getY());
}
GL11.glEnd();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
Here's the code that loads the texture from the file:
private Texture loadTexture(String key){
try {
//in this case, key refers to a valid power of 2, transparent png
return TextureLoader.getTexture("PNG", new FileInputStream(new File("res/"+key+".png")));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}

texture.getFormat()return? - Jason CglBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); glBlendColor(1, 1, 1, 0.5);just for grins and see if it draws it half transparent. If it does, it's a texture format issue. If it doesn't, it's something else. - Jason CTextureLoader.getTexture()and see what it prints:BufferedImage img = ImageIO.read(new File("res/"+key+".png")); System.out.println( img.getColorModel().hasAlpha() );- c.s.