Beispiel #1
0
        int rotation = 0; // model rotation for 3d demonstration

        public Form1()
        {
            /* dot/comma selection for floating point numbers */
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            InitializeComponent();

            glController = new Batu_GL();
            glController.initialize(monitor);
            glController.glInit(monitor, Batu_GL.Ortho_Mode.CENTER);
        }
Beispiel #2
0
        private void fileSelectBt_Click(object sender, EventArgs e)
        {
            OpenFileDialog stldosyaSec = new OpenFileDialog();

            stldosyaSec.Filter = "STL Files|*.stl;*.txt;";

            if (stldosyaSec.ShowDialog() == DialogResult.OK)
            {
                dosyaSecTxb.Text = stldosyaSec.SafeFileName;

                STLReader      stlReader = new STLReader(stldosyaSec.FileName);
                TriangleMesh[] meshArray = stlReader.ReadFile();
                modelVAO = new Batu_GL.VAO_TRIANGLES();

                STLExport stlExporter = new STLExport();

                modelVAO.parameterArray = stlExporter.Get_Mesh_Vertices(meshArray);
                modelVAO.normalArray    = stlExporter.Get_Mesh_Normals(meshArray);
                modelVAO.color          = Color.CadetBlue;

                if (!stlReader.Get_Process_Error())
                {
                    rotation               = 0;
                    drawTimer.Enabled      = true;
                    fileSelectBt.BackColor = Color.DeepSkyBlue;
                }
                else
                {
                    drawTimer.Enabled      = false;
                    fileSelectBt.BackColor = Color.Tomato;

                    /* if there is an error, deinitialize the gl monitor to clear the screen */
                    glController.glInit(monitor, Batu_GL.Ortho_Mode.CENTER);
                    monitor.SwapBuffers();
                }
            }
            else
            {
                // intentionally left blank
            }
        }