I think I'm going insane...
I'm loading bitmaps from a .Theme file. They are 32-bit. But, for some reason, OpenGL draws the transparent portions as black instead of clear. I'm using the BGRA extension, if that helps.
public void LoadTexture(Bitmap name, ref int target)
{
//Debug.WriteLine(file.Pix
elFormat);
using(Bitmap bitmap = new Bitmap(name))
{
bitmap.RotateFlip(RotateFl
ipType.Rot
ateNoneFli
pY);
Rectangle rectangle = new Rectangle(0, 0, bitmap.Width,
bitmap.Height);
BitmapData bitmapData = bitmap.LockBits(rectangle,
ImageLockMode.ReadOnly, PixelFormat.Format32bppArg
b);
Gl.glGenTextures(1, out target);
Gl.glBindTexture(Gl.GL_TEX
TURE_2D, target);
Gl.glTexParameteri(Gl.GL_T
EXTURE_2D,
Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
Gl.glTexParameteri(Gl.GL_T
EXTURE_2D,
Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR);
Glu.gluBuild2DMipmaps(Gl.G
L_TEXTURE_
2D, 3,
bitmapData.Width, bitmapData.Height,
Gl.GL_BGRA_EXT, Gl.GL_UNSIGNED_BYTE,
bitmapData.Scan0);
bitmap.UnlockBits(bitmapDa
ta);
}
}
Any ideas why it displays as black?
Start Free Trial