Exemple #1
0
        public TreeVizControl()
        {
            xrot = 0;
            yrot = 0;
            zrot = 0;
            z    = -5.0f;
            Dock = DockStyle.Fill;

            OpenGL.glShadeModel(OpenGL.GL_SMOOTH);
            //GL.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
            OpenGL.glClearColor(0.25f, 0.25f, 0.25f, 0.5f);
            OpenGL.glClearDepth(1.0f);
            OpenGL.glEnable(OpenGL.GL_DEPTH_TEST);
            OpenGL.glDepthFunc(OpenGL.GL_LEQUAL);
            OpenGL.glHint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST);

            //glEnable(GL_TEXTURE_2D);
            //LoadTextures();
            //GL.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, this.LightAmbient);
            //GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, this.LightDiffuse);
            //GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, this.LightPosition);
            //GL.glEnable(GL.GL_LIGHT1);

            Context.Grab();
            OpenGLException.Assert();

            fPersons      = new List <TVPerson>();
            fPersonsIndex = new Dictionary <string, TVPerson>();
            fStems        = new List <TVStem>();

            fDebug = true;
        }
Exemple #2
0
        // --- Private Methods ---
        #region CreateForm()
        /// <summary>
        /// Creates either a fullscreen form or the user-supplied windowed form, based on the
        /// <see cref="IsFullscreen" /> property.
        /// </summary>
        private static void CreateForm()
        {
            try {
                if (model != null)
                {
                    view = new View(model);                                                                                     // Create A New OpenGL View
                    view.Context.Grab();                                                                                        // Grab The OpenGL Context
                    model.Initialize();                                                                                         // Run Model's Initialize()
                    OpenGLException.Assert();                                                                                   // Check For Any OpenGL Errors

                    if (isFullscreen)                                                                                           // If We're In Fullscreen Mode
                    {
                        form          = new ScreenForm(width, height);                                                          // Create A New Fullscreen Form
                        App.View.Dock = DockStyle.Fill;                                                                         // Fill It With view
                        form.Controls.AddRange(new Control[] { view });                                                         // Add view
                        form.Show();                                                                                            // Show The Fullscreen Form
                    }
                    else                                                                                                        // Otherwise
                    {
                        model.WindowsForm();                                                                                    // Create The User's Defined Windows Form
                    }
                }
                if (isFullscreen)                                                                                                                       // If We're In Fullscreen Mode
                {
                    if (showCursorFullscreen)                                                                                                           // If We're Supposed To Show Cursor
                    {
                        Cursor.Show();                                                                                                                  // Show It
                    }
                    else                                                                                                                                // Otherwise
                    {
                        Cursor.Hide();                                                                                                                  // Hide It
                    }
                }
                else                                                                                                                                    // Else We're In Windowed Mode
                {
                    if (showCursorWindowed)                                                                                                             // If We're Supposed To Show Cursor
                    {
                        Cursor.Show();                                                                                                                  // Show It
                    }
                    else                                                                                                                                // Otherwise
                    {
                        Cursor.Hide();                                                                                                                  // Hide It
                    }
                }
            }
            catch (Exception e) {
                // Handle Any Exceptions While Creating The Application's Form, Exit App
                string errorMsg = "A Basecode Error Occurred While Creating The Application's Form:\n\nStack Trace:\n\t" + e.StackTrace + "\n";
                MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                App.Terminate();
            }
        }