It's most typically an IntPtr
in C#.
Here is an example of how to call this function from C#:
Bitmap bitmap = new Bitmap("blah");
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, 4, bitmap.Width, bitmap.Height, 0, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, bitmap.Scan0);
if(bitmap != null) {
bitmap.Dispose();
}
Source: http://www.gamedev.net/topic/193827-how-to-use-glglteximage2d--using-csgl-library-in-c/
And if what you have is a byte[]
that contains a valid image, you can load it into a bitmap as such:
public static Bitmap BytesToBitmap(byte[] byteArray)
{
using (MemoryStream ms = new MemoryStream(byteArray))
{
Bitmap img = (Bitmap)Image.FromStream(ms);
return img;
}
}
If that gives you trouble, or your data is not something that the Win32 libs can handle, you can use Marshal to give you an IntPtr
from a byte[]
directly.
IntPtr unmanagedPointer = Marshal.AllocHGlobal(bytes.Length);
Marshal.Copy(bytes, 0, unmanagedPointer, bytes.Length);
// Call your function here, passing unmanagedPointer to it
Marshal.FreeHGlobal(unmanagedPointer);
From:
How to get IntPtr from byte[] in C#