PNG Textures in OpenGL
Hi everyone! I'm trying to use PNG images as textures, much like I used to do in C using the GLPNG library. Here's what I'm doing now:
int[] texs = new int[1];
Gl.glGenTextures(1, texs);
tex = texs[0];
Gl.glBindTexture(Gl.GL_TEXTURE_2D, tex);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D,
Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D,
Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D,
Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP);
Gl.glTexParameteri(Gl.GL_TEXTURE_2D,
Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP);
Bitmap bm = new Bitmap("../../The Perry.png");
BitmapData data = bm.LockBits(
new Rectangle(0, 0, bm.Width, bm.Height),
ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format32bppRgb);
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA,
bm.Width, bm.Height, 0,
Gl.GL_RGBA, Gl.GL_BYTE, data.Scan0);
bm.UnlockBits(data);
where "tex" is a class attribute, and is used when drawing to bind the texture. After a bit of struggling, I managed to see something, but the colors are way off. I tried both 32bppRgb and 32bppArgb, to no good.
In particular, the image is a yellow smiley, so R and G should have similar values; instead R is ok, but G is "missing" from the yellow parts (it is non-zero instead on some brown highlights). What's more, where the image is white the rendered scene goes black (*not* transparent, actually solid black).
What am I doing wrong?

Change Gl.GL_RGBA into
Change Gl.GL_RGBA into Gl.GL_BGRA and you are good to go. Faster, too.
------
OpenTK
It doesn't work... If I only
It doesn't work... If I only change the second GL_RGBA (format) into GL_BGRA I get the same result, only mostly blue rather than mostly red (of course). If I change only the first (internalformat) or both I get error 1280 when executing glTexImage2D.
Anyway, I think I understand that .NET gets either ARGB or RGB, but anyway with the red in a more significant byte than the blue.
I'm lost. I'm afraid I'll have to reimplement GLPNG, or at least wrap it in a.NET assembly maybe?
_____________________________________________________
Edit: I figured it out. All it's needed is to change GL_BYTE into GL_UNSIGNED_BYTE. Then I'll use GL_BGRA as recommended. Thanks everyone!