Example #1
0
        /// <summary>
        /// Renders a frame into the frame buffer. First, it is rendering the points and then the shaders.
        /// Please note that depth buffering is enabled, which means that everything is rendered in depth order, not in call order.
        /// </summary>
        public static void RenderFrame()
        {
            Camera.CalculateMatrix();

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            GL.UseProgram(currentShader);
            GL.BindTexture(TextureTarget.Texture1D, currentPalette);
            currentManager.Uniform();

            PlaneRenderable.Render();

            if (Settings.Points)
            {
                GL.UseProgram(DefaultShader);
                DefaultManager.Uniform();

                PointManager.Render();

                DefaultManager.UniformProjection(Camera.ScaleMatrix);
                crosshair1.Render();
                crosshair2.Render();
            }

            // Check for GL errors.
            Utils.CheckError("Render");
        }
Example #2
0
        /// <summary>
        /// Clean up.
        /// </summary>
        public static void Dispose()
        {
            PointManager.Dispose();
            PointRenderable.Dispose();
            PlaneRenderable.Dispose();

            ShaderManager.Dispose();
            PaletteManager.Dispose();
        }
Example #3
0
        /// <summary>
        /// Respond to the resizing of the graph window and update accordingly.
        /// </summary>
        public static void ResizeViewport(int width, int height)
        {
            GL.Viewport(0, 0, width, height);
            GL.Scissor(0, 0, width, height);

            Camera.ResizeViewport(width, height);

            PlaneRenderable.UpdateBuffer();

            Utils.CheckError("Resize");
        }
Example #4
0
        /// <summary>
        /// Initialization process.
        /// </summary>
        public static void Load()
        {
            Camera.Load();

            // Set variables to the settings default.
            Factor1      = new Vector2(Settings.Factor1X, Settings.Factor1Y);
            IMax         = Settings.IMax;
            SquaredLimit = Settings.Limit * Settings.Limit;

            // Load in all the shaders found.
            foreach (var name in FileManager.GetGraphShaderNames())
            {
                ShaderManager.Add(name);
            }

            // Load all palettes found.
            foreach (var name in FileManager.GetPaletteImageNames())
            {
                PaletteManager.Add(name);
            }

            // Set the default shader for points
            ChangeShader(Settings.PointShader, true);

            // Activate the default shader and palette.
            ChangeShader(Settings.DefaultShader);
            ChangePalette(Settings.DefaultPalette);

            // Configure GL properly.
            GL.ClearColor(Color4.Black);

            GL.Enable(EnableCap.Blend);
            GL.LineWidth(2f);

            // generate a GL Buffer with a plane in it and load it into GPU storage.
            PointRenderable.Load();
            PlaneRenderable.Load();

            // Initialize the crosshair.
            crosshair1 = new Point(Vector3.Zero, Color4.Black, 0.012f);
            crosshair2 = new Point(new Vector3(0, 0, -0.000001f), Color4.White);

            // Check for GL errors.
            Utils.CheckError("Load");
        }