Esempio n. 1
0
        static void Main(string[] args)
        {
            int argc = args.Length;

            GLUT.Init(ref argc, args);
            GLUT.InitDisplayMode(GLUT.RGB | GLUT.DOUBLE | GLUT.STENCIL);
            GLUT.InitWindowSize(1000, 600);
            GLUT.CreateWindow("NoesisGUI - GLUT integration");

            NoesisInit();

            GLUT.SetDisplayFunc(OnDisplay);
            GLUT.SetReshapeFunc(OnReshape);
            GLUT.SetPassiveMotionFunc(OnMouseMove);
            GLUT.SetMouseFunc(OnMouseButton);

            GLUT.MainLoop();
        }
Esempio n. 2
0
        static void OnDisplay()
        {
            // Update view (layout, animations, ...)
            _view.Update(GLUT.Get(GLUT.ELAPSED_TIME) / 1000.0);

            // Offscreen rendering phase populates textures needed by the on-screen rendering
            _view.Renderer.UpdateRenderTree();
            _view.Renderer.RenderOffscreen();

            // If you are going to render here with your own engine you need to restore the GPU state
            // because noesis changes it. In this case only framebuffer and viewport need to be restored
            GL.BindFramebuffer(GL.FRAMEBUFFER, 0);
            GL.Viewport(0, 0, (uint)GLUT.Get(GLUT.WINDOW_WIDTH), (uint)GLUT.Get(GLUT.WINDOW_HEIGHT));

            GL.ClearColor(0.0f, 0.0f, 0.25f, 0.0f);
            GL.ClearStencil(0);
            GL.Clear(GL.COLOR_BUFFER_BIT | GL.STENCIL_BUFFER_BIT);

            // Rendering is done in the active framebuffer
            _view.Renderer.Render();

            GLUT.SwapBuffers();
            GLUT.PostRedisplay();
        }