protected override void OnLoad(EventArgs e) { base.OnLoad(e); //m = new ColladaLoader().LoadFile("dice.dae"); m = new ObjLoader().LoadFile("cube.obj"); tex = LoadTex("cube.png"); //m = new Ms3dLoader().LoadFile("test.ms3d"); //m = new ObjLoader().LoadFile("test.obj"); //tex = LoadTex("test.png"); // We do some heuristics to try to auto-zoom to a reasonable distance. And it generally works! double w, l, h; double maxdim; m.Dimensions(out w, out l, out h); Console.WriteLine("Model dimensions: {0} x {0} x {0} (theoretically)", w, l, h); maxdim = Math.Max(Math.Max(w, l), h); viewDist = (float) (maxdim*2); GL.ClearColor(Color.MidnightBlue); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Texture2D); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.NormalArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.EnableClientState(ArrayCap.IndexArray); GL.UseProgram(CompileShaders()); LoadBuffers(); Console.WriteLine("Use a and z to zoom in and out, escape to quit."); }
public Mesh(string fileName) { mesh = ObjLoader.LoadFile(fileName); }