private static GLTexture GLTextureCreateFromBitmap(Bitmap Bitmap) { return GLTexture.Create() .SetFormat(TextureFormat.RGBA) .SetSize(Bitmap.Width, Bitmap.Height) .SetData(Bitmap.GetChannelsDataInterleaved(BitmapChannelList.RGBA)) ; }
private void LoadButton_Click(object sender, EventArgs e) { var Item = (TextureElement)TextureList.SelectedItem; var TextureHookPlugin = PspDisplayForm.Singleton.IGuiExternalInterface.InjectContext.GetInstance<TextureHookPlugin>(); var OpenFileDialog = new OpenFileDialog(); OpenFileDialog.FileName = Item.ToString(); OpenFileDialog.Filter = "Png Image (.png)|*.png"; if (OpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var Bitmap = new Bitmap(Image.FromFile(OpenFileDialog.FileName)); Item.TextureOpengl.SetData(Bitmap.GetChannelsDataInterleaved(BitmapChannelList.RGBA).CastToStructArray<OutputPixel>(), Bitmap.Width, Bitmap.Height); TextureHookPlugin.AddMapping(Item.TextureOpengl.TextureHash, OpenFileDialog.FileName); UpdateTexture(); } }