public Pixmap.Layer RetrievePixelData()
{
DualityApp.GuardSingleThreadState();
int lastTexId;
GL.GetInteger(GetPName.TextureBinding2D, out lastTexId);
GL.BindTexture(TextureTarget.Texture2D, this.glTexId);
byte[] data = new byte[this.texWidth * this.texHeight * 4];
GL.GetTexImage(TextureTarget.Texture2D, 0,
GLPixelFormat.Rgba, PixelType.UnsignedByte,
data);
GL.BindTexture(TextureTarget.Texture2D, lastTexId);
Pixmap.Layer result = new Pixmap.Layer();
result.SetPixelDataRgba(data, this.texWidth, this.texHeight);
return result;
}