예제 #1
0
        static void Main(string[] args)
        {
            scene = new Scene.Scene(800, 600);

            menuList.Add(new InfoMenu(300, scene.HEIGHT - 20, 0, bottomHeight + 20));
            menuList.Add(new BottomMenu(scene.WIDTH, bottomHeight, 0, 0));

            Glut.glutInit();

            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGBA | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(scene.WIDTH + menuList[0].WIDTH, scene.HEIGHT + menuList[1].HEIGHT);

            Glut.glutInitWindowPosition(100, 10);
            int id = Glut.glutCreateWindow("Scene Editor");

            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Draw));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(KeyboardHandle));
            Glut.glutMouseFunc(new Glut.MouseCallback(MouseHandle));
            Glut.glutMouseWheelFunc(new Glut.MouseWheelCallback(MouseWheelHandle));
            //Glut.glutReshapeFunc(new Glut.ReshapeCallback(Resize));
            Glut.glutTimerFunc(1000 / 60, Update, 0);

            Glut.glutMainLoop();
        }
예제 #2
0
        private static void FullscreenMode()
        {
            int oldX      = 50;
            int oldY      = 50;
            int oldWidth  = 320;
            int oldHeight = 320;

            if (screensaver)
            {
                Glut.glutKeyboardFunc(new Glut.KeyboardCallback(ScreensaverKeyboard));
                Glut.glutPassiveMotionFunc(new Glut.PassiveMotionCallback(ScreensaverPassive));
                Glut.glutMouseFunc(new Glut.MouseCallback(ScreensaverMouse));
            }
            else
            {
                Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            }
            Glut.glutSetCursor(Glut.GLUT_CURSOR_NONE);

            oldX      = Glut.glutGet(Glut.GLUT_WINDOW_X);
            oldY      = Glut.glutGet(Glut.GLUT_WINDOW_Y);
            oldWidth  = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            oldHeight = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);

            Glut.glutFullScreen();
        }
예제 #3
0
        /*private void keyboard(byte key, int x, int y)
         * {
         *      int mod = Glut.glutGetModifiers();
         *              if(mod==Glut.GLUT_ACTIVE_CTRL) ctrl=true;
         *              else ctrl=false;
         * }*/

        /**
         * luo glut ikkuna, aseta callbackit ja luo tyhjä texture
         */
        void create(int width, int height)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(width, height);
            Glut.glutInitWindowPosition(100, 100);
            Glut.glutCreateWindow("CSPaint");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(display));
            Glut.glutMouseFunc(new Glut.MouseCallback(mouseButton));
            Glut.glutMotionFunc(new Glut.MotionCallback(mouseMotion));
            Glut.glutCloseFunc(new Glut.CloseCallback(closeWindow));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(reshape));
            //Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keyboard));

            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glClearColor(1, 1, 1, 1);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
            Gl.glDisable(Gl.GL_CULL_FACE);

            Gl.glDisable(Gl.GL_DEPTH_TEST);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Gl.glOrtho(0, width, height, 0, -1, 1);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity();

            // luo yksi taso
            newLayer();
        }
예제 #4
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Voronoi");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Voronoi", 0);
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("[r] Reset", (int)'r');
            Glut.glutAddMenuEntry("[p] Toggle points", (int)'p');
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("Quit", 27);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Init();

            Glut.glutMainLoop();
        }
예제 #5
0
        public static void Main(string[] args)
        {
            int i, j;

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGBA);
            Glut.glutInitWindowSize(320, 320);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Null");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            // Create a pretty color ramp
            for (j = 0; j < 256; j++)
            {
                for (i = 0; i < 256; i++)
                {
                    image[(256 * j + i) * 3 + 0] = (byte)(255 - i * j / 255);
                    image[(256 * j + i) * 3 + 1] = (byte)i;
                    image[(256 * j + i) * 3 + 2] = (byte)j;
                }
            }

            Glut.glutMainLoop();
        }
예제 #6
0
        // --- Entry Point ---
        #region Run()
        public static void Run()
        {
            // initialize GLUT
            Glut.glutInit();
            // double buffer, use rgb color, enable depth buffers
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            // initialize the window size
            Glut.glutInitWindowSize(windowWidth, windowHeight);
            // set the window postion
            Glut.glutInitWindowPosition(100, 100);
            // create the window
            Glut.glutCreateWindow("Starfield");

            // set the display function - called when redrawing
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            // set the idle function - called when idle
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            // set the keyboard function - called on keyboard events
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            // set the mouse function - called on mouse stuff
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            // set the reshape function - called when client area changes
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            // do our own initialization
            Init();

            // let GLUT handle the current thread from here
            Glut.glutMainLoop();
        }
예제 #7
0
 /**
  * loppulätinät
  */
 public void shutdown()
 {
     running = false;
     Glut.glutMouseFunc(null);
     Glut.glutMotionFunc(null);
     Glut.glutCloseFunc(null);
     Glut.glutReshapeFunc(null);
 }
예제 #8
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);
 }
예제 #9
0
//функция, задающая анимацию
//void Timer()
//{
//    Glut.glutPostRedisplay();
//    Glut.glutTimerFunc(10, Timer, 0);
//}

//вызов функций рисования поля
        public void Opengl()
        {
            //glutTimerFunc(10, Timer, 1);
            init();
            Gl.glRasterPos2i(300, 300);
            Glut.glutMouseFunc(new Glut.MouseCallback(MousePressed));
            Glut.glutDisplayFunc(display);
            Glut.glutMainLoop();
            //return 0; /* ISO C requires main to return int. */
        }
예제 #10
0
 public Avatar(GlControl ViewPort, GlObject World)
 {
     camera        = new Camera(origin, center, up);
     this.World    = World;
     this.ViewPort = ViewPort;
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keymove));
     Glut.glutSpecialFunc(new Glut.SpecialCallback(specialKeyMove));
     Glut.glutSpecialUpFunc(new Glut.SpecialUpCallback(specialKeyUp));
     Glut.glutMouseFunc(new Glut.MouseCallback(this.MouseFunc));
 }
예제 #11
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH | Glut.GLUT_ALPHA | Glut.GLUT_STENCIL | Glut.GLUT_MULTISAMPLE);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Tutorial");

            Gl.Enable(EnableCap.DepthTest);

            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(OnDisplay);

            Glut.glutKeyboardFunc(OnKeyboardDown);
            Glut.glutKeyboardUpFunc(OnKeyboardUp);

            Glut.glutCloseFunc(OnClose);
            Glut.glutReshapeFunc(OnReshape);

            // add our mouse callbacks for this tutorial
            Glut.glutMouseFunc(OnMouse);
            Glut.glutMotionFunc(OnMove);

            Gl.Enable(EnableCap.Blend);
            Gl.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            // create our shader program
            program = new ShaderProgram(VertexShader, FragmentShader);

            // create our camera
            camera = new Camera(new Vector3(0, 0, 50), Quaternion.Identity);
            camera.SetDirection(new Vector3(0, 0, -1));

            // set up the projection and view matrix
            program.Use();
            program["projection_matrix"].SetValue(Matrix4.CreatePerspectiveFieldOfView(0.45f, (float)width / height, 0.1f, 1000f));
            program["model_matrix"].SetValue(Matrix4.Identity);

            objectFile = new ObjLoader("enterprise/enterprise.obj", program);

            // load the bitmap font for this tutorial
            font        = new BMFont("font24.fnt", "font24.png");
            fontProgram = new ShaderProgram(BMFont.FontVertexSource, BMFont.FontFragmentSource);

            fontProgram.Use();
            fontProgram["ortho_matrix"].SetValue(Matrix4.CreateOrthographic(width, height, 0, 1000));
            fontProgram["color"].SetValue(new Vector3(1, 1, 1));

            information = font.CreateString(fontProgram, "OpenGL  C#  Tutorial  16");

            watch = System.Diagnostics.Stopwatch.StartNew();

            Glut.glutMainLoop();
        }
예제 #12
0
파일: PolyOff.cs 프로젝트: retahc/old-code
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutCreateWindow("PolyOff");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
예제 #13
0
 public void visualize()
 {
     if (!isInit)
     {
         init();
     }
     Glut.glutDisplayFunc(display);
     Glut.glutKeyboardFunc(keyb);
     Glut.glutMouseFunc(mouse);
     //Glut.glutIdleFunc(display);
     Glut.glutMainLoop();
 }
예제 #14
0
 // Programa Principal
 static void Main()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(400, 350);
     Glut.glutCreateWindow("Visualizacao C#");
     Glut.glutDisplayFunc(Desenha);
     Glut.glutReshapeFunc(AlteraTamanhoJanela);
     Glut.glutSpecialFunc(SpecialKeys);
     Glut.glutMouseFunc(GerenciaMouse);
     Inicializa();
     Glut.glutMainLoop();
 }
예제 #15
0
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(250, 250);
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutCreateWindow("Double");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
예제 #16
0
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(500, 500);
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutCreateWindow("UnProject");
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
예제 #17
0
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(200, 200);
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutCreateWindow("PickDepth");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
예제 #18
0
파일: Task3.cs 프로젝트: max1119/OpenGL1
 public static void Execute()
 {
     Glut.glutInit();
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutInitDisplayMode(Glut.GLUT_RGB);
     Glut.glutInitWindowSize(width, height);
     Glut.glutCreateWindow("OpenGL Task3");
     Glut.glutDisplayFunc(Display);
     //Glut.glutIdleFunc(Display);
     //Glut.ReshapeFunc(Reshape);
     //Glut.glutKeyboardFunc(Keyboard);
     Glut.glutMouseFunc(Mouse);
     Init();
     Glut.glutMainLoop();
 }
예제 #19
0
        public void SetMainLoop()
        {
            //отлов действий пользователя
            Glut.glutMotionFunc(ClickedMotion);
            Glut.glutMouseFunc(Mouse);
            Glut.glutPassiveMotionFunc(PassiveMotion);
            Glut.glutKeyboardFunc(Key);
            Glut.glutKeyboardUpFunc(KeyUp);
            Glut.glutSpecialFunc(KeySpecial);
            Glut.glutSpecialUpFunc(KeySpecialUp);

            //старт игрового цикла
            Glut.glutTimerFunc(Config.TimePerFrame, MainProcess, 0);
            Glut.glutMainLoop();
        }
예제 #20
0
 static void Main()
 {
     Glut.glutInit();
     Glut.glutSetOption(Glut.GLUT_MULTISAMPLE, 8);
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGBA | Glut.GLUT_DEPTH | Glut.GLUT_MULTISAMPLE);
     Glut.glutInitWindowSize(Globals.defaultwindowwidth, Globals.defaultwindowheight);
     Glut.glutCreateWindow("Marvis Console");
     init_graphics();
     Glut.glutDisplayFunc(on_display);
     Glut.glutPassiveMotionFunc(on_mousemove);
     Glut.glutMotionFunc(on_mousemove);
     Glut.glutMouseFunc(on_mouseclick);
     Glut.glutMouseWheelFunc(on_mousewheel);
     Glut.glutIdleFunc(idle);
     Glut.glutReshapeFunc(on_reshape);
     Glut.glutMainLoop();
 }
예제 #21
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Initialisation_3D();
            Glut.glutReshapeFunc(On_Changement_Taille_Fenetre);
            Glut.glutDisplayFunc(Afficher_Ma_Scene);
            Glut.glutKeyboardFunc(Gestion_Clavier);
            Glut.glutSpecialFunc(Gestion_Touches_Speciales);
            Glut.glutIdleFunc(Animation_Scene);
            Glut.glutMouseFunc(Gestion_Bouton_Souris);
            Glut.glutMouseWheelFunc(Gestion_Molette);
            Glut.glutPassiveMotionFunc(Gestion_Souris_Libre);
            Glut.glutMotionFunc(Gestion_Souris_Clique);

            Initialisation_Animation();
            Glut.glutMainLoop();
        }
예제 #22
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(640, 480);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Network Integration");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
            Glut.glutVisibilityFunc(new Glut.VisibilityCallback(Visibility));

            Glut.glutMainLoop();
        }
예제 #23
0
 private void Objekt_Load(object sender, EventArgs e)
 {
     // OpenGL Window Initialisation ( GLUT )
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(width, height);
     Glut.glutCreateWindow("STL Viewer");
     Glut.glutInitWindowPosition(300, -300);
     Glut.glutKeyboardUpFunc(OnKeyboardMoves);
     Glut.glutReshapeFunc(Windowreshape);
     Glut.glutMouseWheelFunc(Mousewheel);
     Glut.glutMouseFunc(OnMouseMoves);
     Glut.glutMotionFunc(OnMove);
     // Glut running functions
     Glut.glutIdleFunc(OnRenderFrame);
     Glut.glutDisplayFunc(OnDisplay);
     // OpenGL Loop Method
     Glut.glutMainLoop();
 }
예제 #24
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(512, 512);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Multiple Viewports");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Init();
            BuildLists();

            Glut.glutMainLoop();
        }
예제 #25
0
        static void Main()
        {
            // create an OpenGL window
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL UI: Example 1");

            // provide the Glut callbacks that are necessary for running this tutorial
            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(() => { });    // only here for mac os x
            Glut.glutCloseFunc(OnClose);
            Glut.glutMouseFunc(OnMouseClick);
            Glut.glutMotionFunc(OnMouseMove);
            Glut.glutPassiveMotionFunc(OnMouseMove);
            Glut.glutReshapeFunc(OnResize);
            Glut.glutKeyboardFunc(OnKeyboard);

            // enable depth testing to ensure correct z-ordering of our fragments
            Gl.Enable(EnableCap.DepthTest);
            Gl.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            // initialize the user interface
            OpenGL.UI.UserInterface.InitUI(width, height);

            // create some centered text
            OpenGL.UI.Text welcome = new OpenGL.UI.Text(OpenGL.UI.Text.FontSize._24pt, "Welcome to OpenGL", OpenGL.UI.BMFont.Justification.Center);
            welcome.RelativeTo = OpenGL.UI.Corner.Center;

            // create some colored text
            OpenGL.UI.Text coloredText = new OpenGL.UI.Text(OpenGL.UI.Text.FontSize._24pt, "using C#", OpenGL.UI.BMFont.Justification.Center);
            coloredText.Position   = new Point(0, -30);
            coloredText.Color      = new Vector3(0.2f, 0.3f, 1f);
            coloredText.RelativeTo = OpenGL.UI.Corner.Center;

            // add the two text object to the UI
            OpenGL.UI.UserInterface.AddElement(welcome);
            OpenGL.UI.UserInterface.AddElement(coloredText);

            // enter the glut main loop (this is where the drawing happens)
            Glut.glutMainLoop();
        }
예제 #26
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_MULTISAMPLE);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutInitWindowSize(w_win, h_win);
            Glut.glutCreateWindow("FTGL TEST");
            Glut.glutDisplayFunc(display);
            Glut.glutKeyboardFunc(parsekey);
            Glut.glutSpecialFunc(parseSpecialKey);
            Glut.glutMouseFunc(mouse);
            Glut.glutMotionFunc(motion);
            Glut.glutReshapeFunc(myReshape);
            Glut.glutIdleFunc(display);

            myinit();
            mytest();

            Glut.glutMainLoop();
        }
예제 #27
0
파일: Input.cs 프로젝트: mrenow/2D-Game
        public static void Init()
        {
            Keys              = new bool[255];
            KeysTyped         = new bool[255];
            SpecialKeys       = new bool[255];
            Mouse             = new bool[3];
            KeysTypedCooldown = new CooldownTimer[255];
            for (int i = 0; i < KeysTypedCooldown.Length; i++)
            {
                KeysTypedCooldown[i] = new CooldownTimer(3);
            }

            Glut.glutKeyboardFunc(OnKeyboardDown);
            Glut.glutKeyboardUpFunc(OnKeyboardUp);
            Glut.glutSpecialFunc(OnSpecialDown);
            Glut.glutSpecialUpFunc(OnSpecialUp);
            Glut.glutMouseFunc(OnMousePress);
            Glut.glutMotionFunc(OnMouseMove);
            Glut.glutPassiveMotionFunc(OnMouseMove);
            Glut.glutMouseWheelFunc(OnMouseScroll);
        }
예제 #28
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutCreateWindow("SurfaceOld");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Show control points", 1);
            Glut.glutAddMenuEntry("Hide control points", 0);
            Glut.glutAddMenuEntry("Solid", 2);
            Glut.glutAddMenuEntry("Wireframe", 3);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Glut.glutMainLoop();
        }
예제 #29
0
 static void Main(string[] args)
 //programos vykdymo pradžia
 {                                                                      //
     Glut.glutInit();                                                   //inicializuojama GLUT aplinka
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);        //nustatomi vaizdavimo parametrai
     Glut.glutInitWindowSize(400, 400);                                 //nustatomas programos lango dydis
     Glut.glutInitWindowPosition(400, 300);                             //nustatoma lango pozicija
     Glut.glutCreateWindow("NIF06020");                                 //sukuriamas langas
     Init();                                                            //papildomi OpenGL būsenų nustatymai
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Figura));            //vaizdavimo metodo uzregistravimas
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Klaviatura1));     //metodo klaviatura1 uzregistravimas
     Glut.glutSpecialFunc(new Glut.SpecialCallback(Klaviatura2));       //metodo klaviatura2 uzregistravimas
     Glut.glutMouseFunc(new Glut.MouseCallback(Pele));                  //metodo pele uzregistravimas
     Glut.glutCreateMenu(new Glut.CreateMenuCallback(Meniu));           //metodo meniu uzregistravimas
     Glut.glutAddMenuEntry("Pirmas punktas", '1');                      //i kontekstini meniu itraukiamas pirmas pasirinkimas
     Glut.glutAddMenuEntry("Antras punktas", '2');                      //i kontekstini meniu itraukiamas antras pasirinkimas
     Glut.glutAddMenuEntry("Trecias punktas", '3');                     //i kontekstini meniu itraukiamas trecias pasirinkimas
     Glut.glutAddMenuEntry("Ketvirtas punktas", '4');                   //i kontekstini meniu itraukiamas ketvirtas pasirinkimas
     Glut.glutAddMenuEntry("Penktas punktas", '5');                     //i kontekstini meniu itraukiamas penktas pasirinkimas
     Glut.glutAddMenuEntry("Progamos pabaiga", '6');                    //i kontekstini meniu itraukiamas sestas pasirinkimas
     Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);                       //uzregistuojamas iskleidziamas meniu
     Glut.glutMainLoop();                                               //pradedamas vykdyti grafines programos ciklas
 }                                                                      //
예제 #30
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_RGB | Glut.GLUT_SINGLE);
            Glut.glutInitWindowSize(320, 320);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Strip (Click to draw)");

            for (int k = 0; k < MAXMESH; k++)
            {
                for (int i = 0; i < MAXMESH; i++)
                {
                    mesh[k, i] = (float)(Math.Sin((float)(i + k) / MAXMESH * PI) * 3);
                }
            }

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMouseFunc(new Glut.MouseCallback(Mouse));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutMainLoop();
        }