Example #1
0
        //private EventHandler mouseEnter;
        //private EventHandler mouseLeave;
        /// <summary>
        /// Creats render context and supports OpenGL rendering.
        /// </summary>
        public GLSceneCanvas()
        {
            InitializeComponent();

            //  Set the user draw styles.
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            // check http://stackoverflow.com/questions/34664/designmode-with-controls
            this.designMode = this.DesignMode || System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime;

            //if (!this.designMode)
            //{
            //    //this.mouseEnter = GLCanvas_MouseEnter;
            //    this.mouseEnter = (x, y) => ShowCursor(0);// hide system's cursor.
            //    this.mouseLeave = (x, y) => ShowCursor(1);// show system's cursor.
            //}
            {
                var camera = new Camera(
                    new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0),
                    CameraType.Perspecitive, this.Width, this.Height);
                var scene = new Scene(camera, this);
                this.Scene = scene;
                this.Resize += scene.Resize;
                var rotator = new FirstPerspectiveManipulater();// SatelliteManipulater();
                //rotator.Bind(camera, this);
                this.CameraManipulater = rotator;
            }
            this.fullname = this.GetType().FullName;
        }
Example #2
0
        /// <summary>
        /// render scene in this view port.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="clientRectangle"></param>
        /// <param name="pickingGeometryType"></param>
        public override void Render(Scene scene, System.Drawing.Rectangle clientRectangle, PickingGeometryType pickingGeometryType)
        {
            this.On();// limit rendering area.

            vec4 color = this.ClearColor.ToVec4();
            OpenGL.glClearColor(color.x, color.y, color.z, color.w);

            OpenGL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT);

            this.Off();// cancel limitation.
        }
Example #3
0
 /// <summary>
 /// an object to be rendered in a scene.
 /// </summary>
 public SceneRootObject(Scene bindingScene)
 {
     this.BindingScene = bindingScene;
 }
Example #4
0
 /// <summary>
 /// Render <see cref="IRenderable"/> objects.
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="clearMask"></param>
 public RenderAction(Scene scene, uint clearMask = GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT)
     : base(scene)
 {
     this.ClearMask = clearMask;
 }
Example #5
0
 /// <summary>
 /// Render <see cref="IRenderable"/> objects.
 /// </summary>
 /// <param name="scene"></param>
 public GUIRenderAction(Scene scene) : base(scene)
 {
 }
Example #6
0
 /// <summary>
 /// Base type for rendering actions.
 /// </summary>
 /// <param name="scene"></param>
 public ActionBase(Scene scene)
 {
     this.Scene = scene;
 }