public BmdRenderer(Bmd model) { m_Model = model; string[] extensions = GL.GetString(StringName.Extensions).Split(' '); m_HasShaders = extensions.Contains("GL_ARB_shading_language_100") && extensions.Contains("GL_ARB_shader_objects") && extensions.Contains("GL_ARB_vertex_shader") && extensions.Contains("GL_ARB_fragment_shader"); // TODO: setting for turning shaders on/off m_Textures = new int[model.Textures.Length]; for (int i = 0; i < model.Textures.Length; i++) { UploadTexture(i); } if (m_HasShaders) { m_Shaders = new Shader[model.Materials.Length]; for (int i = 0; i < model.Materials.Length; i++) { GenerateShaders(i); //Removed catch 1/22/15 } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "BMD files (*.bmd)|*.bmd|All files (*.*)|*.*"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { if (loaded) { GL.DeleteLists(loadedList, 1); } FileBase fb = new FileBase(); fb.Stream = new FileStream(openFileDialog1.FileName, FileMode.Open); loadedBmd = new Bmd(fb); fb.Close(); loadedList = GL.GenLists(1); GL.NewList(loadedList, ListMode.Compile); if (loadedBmd != null) { MainWindow.DrawBMD(loadedBmd); } GL.EndList(); } }