Exemple #1
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'l')
     {
         lighting = !lighting;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 32)
     {
         autoRotate = !autoRotate;
     }
     else if (key == 27)
     {
         Glut.glutLeaveMainLoop();
     }
 }
Exemple #2
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'w')
     {
         up = false;
     }
     else if (key == 's')
     {
         down = false;
     }
     else if (key == 'd')
     {
         right = false;
     }
     else if (key == 'a')
     {
         left = false;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
Exemple #3
0
 private static void WindowedMode()
 {
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutPassiveMotionFunc(null);
     Glut.glutMouseFunc(null);
     Glut.glutSetCursor(Glut.GLUT_CURSOR_INHERIT);
     Glut.glutPositionWindow(50, 50);
     Glut.glutReshapeWindow(320, 320);
 }
Exemple #4
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'l')
     {
         lighting = !lighting;
     }
     else if (key == ' ')
     {
         autoRotate = !autoRotate;
     }
     else if (key == 'a')
     {
         left = false;
     }
     else if (key == 'w')
     {
         up = false;
     }
     else if (key == 'd')
     {
         right = false;
     }
     else if (key == 's')
     {
         down = false;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 'b')
     {
         alpha = !alpha;
         if (alpha)
         {
             Gl.Enable(EnableCap.Blend);
             Gl.Disable(EnableCap.DepthTest);
         }
         else
         {
             Gl.Disable(EnableCap.Blend);
             Gl.Enable(EnableCap.DepthTest);
         }
     }
 }
Exemple #5
0
 private void UpdateFullscreen(bool fullscreen)
 {
     if (fullscreen)
     {
         Glut.glutFullScreen();
     }
     else
     {
         Glut.glutPositionWindow(0, 0);
         Glut.glutReshapeWindow(formWidth, formHeight);
     }
 }
Exemple #6
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'w') up = false;
     else if (key == 's') down = false;
     else if (key == 'd') right = false;
     else if (key == 'a') left = false;
     else if (key == ' ') autoRotate = !autoRotate;
     else if (key == 'l') lighting = !lighting;
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen) Glut.glutFullScreen();
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
Exemple #7
0
 private static void OnKeyboardUp(byte key, int x, int y)
 {
     if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
     else if (key == 'r')
     {
         rainbow = !rainbow;
         program.Use();
         program["static_colors"].SetValue(rainbow);
     }
 }
Exemple #8
0
 private static void OnKeyDown(byte key, int x, int y)
 {
     if (key == 'w')
     {
         xangle -= step;
     }
     else if (key == 's')
     {
         xangle += step;
     }
     else if (key == 'a')
     {
         yangle -= step;
     }
     else if (key == 'd')
     {
         yangle += step;
     }
     else if (key == ' ')
     {
         stopwatch = stopwatch == null?System.Diagnostics.Stopwatch.StartNew() : null;
     }
     else if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
         }
     }
     else if (key == 27)
     {
         Glut.glutLeaveMainLoop();
     }
 }
        public SonicOpenGLStateVisualizer( )
        {
            int i = 0;

            Glut.glutInit(ref i, null);
            Glut.glutInitDisplayMode(Glut.GLUT_RGBA | Glut.GLUT_DOUBLE);

            Glut.glutCreateWindow("Map");
            Glut.glutPositionWindow(0, 0);
            Glut.glutFullScreen( );

            Gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity( );
            Gl.glOrtho(0.0f, winWid, 0.0f, winHeight, -100.0f, 100.0f);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity( );
            Glut.glutIdleFunc(new Glut.IdleCallback(redraw));
            Glut.glutDisplayFunc(new Glut.DisplayCallback(redraw));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keyboard));
            //new Thread( new ThreadStart( Glut.glutMainLoop ) ).Start( );
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
        }
Exemple #10
0
 private static void OnKeyboardMoves(byte key, int x, int y)
 {
     if (key == 'a')
     {
         rotx = rotx + 3;
     }
     else if (key == 'z')
     {
         rotx = rotx - 3;
     }
     else if (key == 'e')
     {
         roty = roty + 3;
     }
     else if (key == 'r')
     {
         roty = roty - 3;
     }
     else if (key == 't')
     {
         rotz = rotz + 3;
     }
     else if (key == 'y')
     {
         rotz = rotz - 3;
     }
     else if (key == '+')
     {
         zoom = zoom + 3;
     }
     else if (key == '-')
     {
         zoom = zoom - 3;
     }
     else if (key == 'q')
     {
         translatex = translatex + 1;
     }
     else if (key == 's')
     {
         translatex = translatex - 1;
     }
     else if (key == 'd')
     {
         translatey = translatey + 1;
     }
     else if (key == 'g')
     {
         translatey = translatey - 1;
     }
     if (key == 'f')
     {
         fullscreen = !fullscreen;
         if (fullscreen)
         {
             Glut.glutFullScreen();
         }
         else
         {
             Glut.glutPositionWindow(0, 0);
             Glut.glutReshapeWindow(1280, 720);
         }
     }
 }
Exemple #11
0
        private static void OnKeyboardUp(byte key, int x, int y)
        {
            if (key == 'w')
            {
                up = false;
            }
            else if (key == 's')
            {
                down = false;
            }
            else if (key == 'd')
            {
                right = false;
            }
            else if (key == 'a')
            {
                left = false;
            }
            else if (key == ' ')
            {
                autoRotate = !autoRotate;
                if (autoRotate)
                {
                    wplayer.controls.play();
                }
                else
                {
                    wplayer.controls.stop();
                }

                Rain.rainbow = !Rain.rainbow;
                Rain.program.Use();
                Rain.program["static_colors"].SetValue(Rain.rainbow);

                Smoke.rainbow = !Smoke.rainbow;
                Smoke.program.Use();
                Smoke.program["static_colors"].SetValue(Smoke.rainbow);
            }
            else if (key == 'l')
            {
                lighting = !lighting;
            }
            else if (key == 'z')
            {
                fullscreen = !fullscreen;
                if (fullscreen)
                {
                    Glut.glutFullScreen();
                }
                else
                {
                    Glut.glutPositionWindow(0, 0);
                    Glut.glutReshapeWindow(1280, 720);
                }
            }
            else if (key == 'b')
            {
                alpha = !alpha;
                if (alpha)
                {
                    Gl.Enable(EnableCap.Blend);
                    Gl.Disable(EnableCap.DepthTest);
                }
                else
                {
                    Gl.Disable(EnableCap.Blend);
                    Gl.Enable(EnableCap.DepthTest);
                }
            }
            if (key == 'f')
            {
                fullscreen = !fullscreen;
                if (fullscreen)
                {
                    Glut.glutFullScreen();
                }
                else
                {
                    Glut.glutPositionWindow(0, 0);
                    Glut.glutReshapeWindow(1280, 720);
                }
            }
            else if (key == 'r')
            {
                Rain.rainbow = !Rain.rainbow;
                Rain.program.Use();
                Rain.program["static_colors"].SetValue(Rain.rainbow);

                Smoke.rainbow = !Smoke.rainbow;
                Smoke.program.Use();
                Smoke.program["static_colors"].SetValue(Smoke.rainbow);
            }
        }