Esempio n. 1
0
        /// <summary>
        /// Creates a default light and enables the active shader
        /// </summary>
        private void SetupShader(RhGLShaderProgram shader, RMModel model, ViewportInfo viewport)
        {
            // Check to make sure we actually have an active shader...
            if (shader != null) {

                // Enable...
                shader.Enable ();

                // Now setup and initialize frustum and lighting...
                int near, far;
                viewport.GetScreenPort (out near, out far);
                viewport.SetScreenPort ((int)Frame.Left, (int)Frame.Right, (int)Frame.Bottom, (int)Frame.Top, near, far);
                shader.SetupViewport (viewport);
                Rhino.Geometry.Light light = CreateDefaultLight ();
                shader.SetupLight (light);
                light.Dispose ();
            }
        }