public void RefreshGlTexturesByName() { glTexByName.Clear(); foreach (BRTI tex in Nodes) { Texture2D tex2d = BRTI.CreateTexture2D(tex.texture); tex.texture.display = tex2d; tex.display = tex.texture.display; glTexByName.Add(tex.Text, tex2d); } }
private void replaceTextureToolStripMenuItem_Click(object sender, EventArgs e) { using (var ofd = new OpenFileDialog()) { BRTI t = (BRTI)(textureListBox.SelectedItem); ofd.Filter = "Portable Network Graphic (.png)|*.png;|" + "All files(*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { Edited = true; BRTI.BRTI_Texture newTexture = null; if (Path.GetExtension(ofd.FileName).ToLower().Equals(".png")) { newTexture = fromPNG(ofd.FileName, 1); } if (Path.GetExtension(ofd.FileName).ToLower().Equals(".dds")) { DDS dds = new DDS(new FileData(ofd.FileName)); newTexture = dds.toBRTITexture(); } t.texture.height = newTexture.height; t.texture.width = newTexture.width; t.texture.pixelInternalFormat = newTexture.pixelInternalFormat; t.texture.mipmaps = newTexture.mipmaps; t.texture.pixelFormat = newTexture.pixelFormat; t.texture.data = newTexture.data; GL.DeleteTexture(t.texture.display); BNTX.glTexByName.Add(ofd.FileName, BRTI.CreateTexture2D(t.texture)); if (newTexture == null) { return; } FillForm(); } } }