Beispiel #1
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");
     SetupTimers();
     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();
 }
Beispiel #2
0
        public static void Main(string[] args)
        {
            try {
                if (args.Length > 1)
                {
                    if (args[1] == "-h")
                    {
                        Console.WriteLine(args[0] + " [stars]");
                        Environment.Exit(0);
                    }
                    else
                    {
                        numberStars = Int32.Parse(args[1]);
                    }
                }
            }
            catch (Exception e) {
                Console.WriteLine("Error parsing commandline.  stars should be an integer.  Try again.\n\n" + e.ToString());
                Environment.Exit(-1);
            }

            stars = new Star[numberStars];

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

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            if (screensaver)
            {
                FullscreenMode();
            }
            else
            {
                WindowedMode();
            }

            Glut.glutMainLoop();
        }
Beispiel #3
0
        public void Init()
        {
            //Open GL init
            #region
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("Maraca craft");

            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(OnDisplay);
            Glut.glutCloseFunc(OnClose);
            Glut.glutKeyboardFunc(OnKeyboardDown);

            Gl.ClearColor(0, 0, 0, 1);

            //Alpha enabled
            Gl.Enable(EnableCap.DepthTest);
            Gl.Enable(EnableCap.Blend);
            Gl.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            #endregion

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

            //Create perspective
            program.Use();
            program["projection_matrix"].SetValue(
                Matrix4.CreatePerspectiveFieldOfView(0.95f,
                                                     (float)width / height, 0.1f, 1000f));
            Vector3 camPos = new Vector3(0, 0, 0);
            //-5 3 -5
            program["view_matrix"].SetValue(
                Matrix4.CreateTranslation(new Vector3(0, 0, 0)) *
                Matrix4.LookAt(new Vector3(0, 0, -1),
                               camPos,
                               new Vector3(0, 1, 0)));


            player = new Player(0, 0, 0);
            CreateModels();

            Glut.glutMainLoop();
        }
Beispiel #4
0
        public static void Run()
        {
            try {
                //if(args.Length > 1) {
                //    if(args[1] == "-h") {
                //        Console.WriteLine(args[0] + " [lines] [step]");
                //        Environment.Exit(0);
                //    }
                //    else {
                //        points = Int32.Parse(args[1]);
                //        if(args.Length > 2) {
                //            step = Single.Parse(args[2]);
                //        }
                //    }
                //}
            }
            catch (Exception e) {
                Console.WriteLine("Error parsing commandline.  lines should be an integer, step should be a float.  Try again.\n\n" + e.ToString());
                Environment.Exit(-1);
            }

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

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            if (screensaver)
            {
                FullscreenMode();
            }
            else
            {
                WindowedMode();
            }

            InitLines();

            Glut.glutMainLoop();
        }
Beispiel #5
0
 static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(400, 400);
     Glut.glutInitWindowPosition(400, 300);
     Glut.glutCreateWindow("Grafiniai primityvai");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(figura));
     Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
     Glut.glutAddMenuEntry("(1)I Ketvirtis", 1);
     Glut.glutAddMenuEntry("(2)II Ketvirtis", 2);
     Glut.glutAddMenuEntry("(3)III Ketvirtis", 3);
     Glut.glutAddMenuEntry("(4)IV Ketvirtis", 4);
     Glut.glutAddMenuEntry("(5)Sumazint, pasukt ir pastumt", 5);
     Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();                  //pradedamas vykdyti grafinės programos ciklas
 }
Beispiel #6
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();
        }
Beispiel #7
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();
 }
        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();
        }
Beispiel #9
0
        static int pontoJogador2 = 0;           // Contador pontos jogador2.@@
        #endregion

        static void Main(string[] args)
        {
            Console.Write("Futebol 2D");
            Console.WriteLine("Informe o nome do Primeiro Jogador: ");
            jogador1 = Console.ReadLine();
            Console.WriteLine("Informe o nome do segundo jogador: ");
            jogador2 = Console.ReadLine();

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(800, 400);
            Glut.glutInitWindowPosition(100, 100);
            Glut.glutCreateWindow("Copa do Mundo");
            inicialize();
            Glut.glutDisplayFunc(desenhar);
            Glut.glutSpecialFunc(moverGoleiroBrasil);
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(moverGoleiroAlemanha));
            Glut.glutTimerFunc(100, Timer, 1);
            Glut.glutMainLoop();
        }
Beispiel #10
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();
        }
Beispiel #11
0
        public static void Run()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(450, 150);
            Glut.glutCreateWindow("FogOld");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Fog EXP", Gl.GL_EXP);
            Glut.glutAddMenuEntry("Fog EXP2", Gl.GL_EXP2);
            Glut.glutAddMenuEntry("Fog LINEAR", Gl.GL_LINEAR);
            Glut.glutAddMenuEntry("Quit", 0);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Glut.glutMainLoop();
        }
        public void Main()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGBA | Glut.GLUT_DEPTH);

            Glut.glutInitWindowSize(480, 480);
            Glut.glutInitWindowPosition(500, 0);
            Glut.glutCreateWindow("InvenSense Tea Pot Demo");

            DemoInit();
            qData = new QuatPacket_Bean();

            //Glut.glutDisplayFunc(DemoDisplayMain);
            //Glut.glutKeyboardUpFunc(DemoKeyboardUpFunc);
            Glut.glutReshapeFunc(ReshapeWindowSize);
            Glut.glutIdleFunc(DemoDisplayIdle);
            Gl.glEnable(Gl.GL_BLEND);
            DemoDisplayMain();
            Glut.glutMainLoop();
        }
Beispiel #13
0
        static void Main()
        {
            Glut.glutInit();

            Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(500, 300);
            Glut.glutInitWindowPosition(10, 10);
            Glut.glutCreateWindow("PONG");
            Inicializa();
            Glut.glutPassiveMotionFunc(rend.MoveMouse);
            Glut.glutTimerFunc(33, Timer, 1);
            Glut.glutDisplayFunc(rend.Desenha);
            Glut.glutReshapeFunc(AlteraTamanhoJanela);
            Glut.glutKeyboardFunc(evento.GerenciaTeclado);
            Glut.glutSpecialFunc(TeclasEspeciais);



            Glut.glutMainLoop();
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            wplayer.URL = "song.mp3";
            wplayer.controls.stop();

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH | Glut.GLUT_MULTISAMPLE);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("UAS IF3260 - Grafika Komputer");

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

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

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

            Gl.Enable(EnableCap.DepthTest);
            Gl.Enable(EnableCap.Multisample);
            Gl.Enable(EnableCap.ProgramPointSize);
            Gl.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);

            program = new ShaderProgram(VertexShader, FragmentShader);

            program.Use();
            program["projection_matrix"].SetValue(Matrix4.CreatePerspectiveFieldOfView(0.45f, (float)width / height, 0.1f, 1000f));
            program["view_matrix"].SetValue(Matrix4.LookAt(new Vector3(0, 0, 6), new Vector3(1.2f, 0.2f, 0f), new Vector3(0, 1, 0)));

            program["light_direction"].SetValue(new Vector3(0, 0, 1));
            program["enable_lighting"].SetValue(lighting);

            carmodel = new CarModel();
            rain     = new Rain();
            smoke    = new Smoke();

            watch = System.Diagnostics.Stopwatch.StartNew();
            Glut.glutMainLoop();
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitWindowPosition(100, 100);
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Less2");
            Init();
            Glut.glutDisplayFunc(DisplayScene);
            Glut.glutIdleFunc(DisplayScene);

            /*Glut.glutDisplayFunc(drawSnowMan);
             * Glut.glutIdleFunc(drawSnowMan);*/
            /*Glut.glutDisplayFunc(Test.RenderWireSphere);
             * Glut.glutIdleFunc(Test.RenderWireSphere);*/
            /*Glut.glutDisplayFunc(Test.Display);
             * Glut.glutIdleFunc(Test.Display);*/
            Glut.glutSpecialFunc(processSpecialKeys);
            Glut.glutKeyboardFunc(processNormalKeys);
            Glut.glutMainLoop();
        }
Beispiel #16
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();
        }
Beispiel #17
0
        private static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine("Для применения поворота используются следующие клавиши:\n" +
                              "- \"w\", \"s\" - вокруг оси X;\n" +
                              "- \"a\", \"d\" - вокруг оси Y;\n" +
                              "- \"q\", \"e\" - вокруг оси Z.\n" +
                              "Следует удостовериться что ввод на английском языке.\n" +
                              "Для запуска нажмите любой символ на клавиатуре.");
            Console.ReadKey();

            pyramid = new Pyramid();
            cube    = new Cube();

            Glut.GlutInit();
            Glut.glutCreateWindow("GeometricModelingLR3");
            Glut.glutInitWindowSize(300, 300);
            Glut.glutInitWindowPosition(0, 0);
            Glut.GlutDisplayFunc(Display);
            Glut.GlutKeyboardFunc(ClickKeyboardKeys);
            Glut.glutMainLoop();
        }
Beispiel #18
0
        public static void Main()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(DefaultWidth, DefaultHeight);
            Glut.glutCreateWindow("OpenGL Toutorial");

            Camera camera = new Camera();

            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(OnDisplay);
            Glut.glutCloseFunc(OnClose);
            Glut.glutKeyboardFunc(OnKeyboardDown);
            Glut.glutKeyboardUpFunc(OnKeyboardUp);
            Glut.glutReshapeFunc(camera.OnReshape);

            Gl.Enable(EnableCap.DepthTest);

            Texture1 = new Texture("Grass1.jpg");
            Cube     = new VBO <Vector3>(new Vector3[] {
                new Vector3(1, 1, -1), new Vector3(-1, 1, -1), new Vector3(-1, 1, 1), new Vector3(1, 1, 1),     //top
                new Vector3(1, -1, 1), new Vector3(-1, -1, 1), new Vector3(-1, -1, -1), new Vector3(1, -1, -1), //bottom
                new Vector3(1, 1, 1), new Vector3(-1, 1, 1), new Vector3(-1, -1, 1), new Vector3(1, -1, 1),     //front face
                new Vector3(1, -1, -1), new Vector3(-1, -1, -1), new Vector3(-1, 1, -1), new Vector3(1, 1, -1), //back face
                new Vector3(-1, 1, 1), new Vector3(-1, 1, -1), new Vector3(-1, -1, -1), new Vector3(-1, -1, 1), //left face
                new Vector3(1, 1, -1), new Vector3(1, 1, 1), new Vector3(1, -1, 1), new Vector3(1, -1, -1)
            });                                                                                                 //right face
            CubeUV = new VBO <Vector2>(new Vector2[] {
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1),
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1),
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1),
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1),
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1),
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1)
            });
            CubeQuads = new VBO <int>(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, BufferTarget.ElementArrayBuffer);

            Glut.glutMainLoop();
        }
Beispiel #19
0
        public static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_MULTISAMPLE | Glut.GLUT_RGBA);
            Glut.glutInitWindowSize(800, 600);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutCreateWindow("Maiden");

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(Special));

            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutAddMenuEntry("Toggle texture mapping", (int)'t');
            Glut.glutAddMenuEntry("Toggle texture mode", (int)'m');
            Glut.glutAddMenuEntry("Toggle filter mode", (int)'f');
            Glut.glutAddMenuEntry("Toggle performance", (int)'p');
            Glut.glutAddMenuEntry("Toggle background", (int)'b');
            Glut.glutAddMenuEntry("Toggle animation", (int)' ');
            Glut.glutAddMenuEntry("Toggle culling", (int)'c');
            Glut.glutAddMenuEntry("Toggle stars", (int)'*');
            Glut.glutAddMenuEntry("Time full frame (no swap)", (int)'n');
            Glut.glutAddMenuEntry("Print pixels/frame", (int)'r');
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("> and < keys change # of textures", 0);
            Glut.glutAddMenuEntry("Arrows up/down change level of detail", 0);
            Glut.glutAddMenuEntry("Arrows right/left change # of spheres", 0);
            Glut.glutAddMenuEntry("1-4 keys change background image", 0);
            Glut.glutAddMenuEntry("", 0);
            Glut.glutAddMenuEntry("Quit", (int)'r');
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

            Init();
            LoadTextures();

            Glut.glutMainLoop();
        }
Beispiel #20
0
        static void Main()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(Width, Height);

            ScreenWidth  = Glut.glutGet(Glut.GLUT_SCREEN_WIDTH);
            ScreenHeight = Glut.glutGet(Glut.GLUT_SCREEN_HEIGHT);

            Glut.glutInitWindowPosition((ScreenWidth - Width) / 2, (ScreenHeight - Height) / 2);
            Glut.glutCreateWindow("");
            //Glut.glutGameModeString(Width+"x"+Height+":32@60");

            Glut.glutSetOption(Glut.GLUT_ACTION_ON_WINDOW_CLOSE, Glut.GLUT_ACTION_CONTINUE_EXECUTION);
            Gl.Viewport(0, 0, Width, Height);
            Glut.glutDisplayFunc(delegate() { });
            Glut.glutIdleFunc(MainGameLoop);

            Init();

            Glut.glutMainLoop();
        }
Beispiel #21
0
        static void Main(string[] args)
        {
            // create an OpenGL window
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Tutorial");

            // provide the Glut callbacks that are necessary for running this tutorial
            Glut.glutIdleFunc(OnRenderFrame);
            Glut.glutDisplayFunc(OnDisplay);
            Glut.glutCloseFunc(OnClose);

            // enable depth testing to ensure correct z-ordering of our fragments
            Gl.Enable(EnableCap.DepthTest);

            // compile the shader program
            program = new ShaderProgram(VertexShader, FragmentShader);

            // set the view and projection matrix, which are static throughout this tutorial
            program.Use();
            program["projection_matrix"].SetValue(Matrix4.CreatePerspectiveFieldOfView(0.45f, (float)width / height, 0.1f, 1000f));
            program["view_matrix"].SetValue(Matrix4.LookAt(new Vector3(0, 0, 10), Vector3.Zero, new Vector3(0, 1, 0)));

            // create a triangle with vertices and colors
            triangle         = new VBO <Vector3>(new Vector3[] { new Vector3(0, 1, 0), new Vector3(-1, -1, 0), new Vector3(1, -1, 0) });
            triangleColor    = new VBO <Vector3>(new Vector3[] { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1) });
            triangleElements = new VBO <uint>(new uint[] { 0, 1, 2 }, BufferTarget.ElementArrayBuffer);

            // create a square with vertices an colors
            square         = new VBO <Vector3>(new Vector3[] { new Vector3(-1, 1, 0), new Vector3(1, 1, 0), new Vector3(1, -1, 0), new Vector3(-1, -1, 0) });
            squareElements = new VBO <uint>(new uint[] { 0, 1, 2, 3 }, BufferTarget.ElementArrayBuffer);
            squareColor    = new VBO <Vector3>(new Vector3[] { new Vector3(0.5f, 0.5f, 1), new Vector3(0.5f, 0.5f, 1), new Vector3(0.5f, 0.5f, 1), new Vector3(0.5f, 0.5f, 1) });

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

            Glut.glutMainLoop();
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            _starfield  = new StarField(150);
            _blackfog   = new BlackFog();
            _scrolltext = new ScrollText(
                "FTGL 2.1.3: A NEW VERSION\n"
                + "\n"
                + "FTGL is a free cross-platform Open Source library that "
                + "uses Freetype2 to simplify rendering fonts in OpenGL "
                + "applications. FTGL supports bitmap, pixmap, texture map, "
                + "outline, polygon mesh, and extruded polygon rendering "
                + "modes.\n"
                + "\n"
                + "FTGL offers both a C++ and a plain C programming interface. "
                + "Various bindings exist for other languages such as Python or "
                + "Ruby. This program was done in C# using FTGL's .NET "
                + "language bindings.\n"
                + "\n"
                + "It's time to press ESC because this is the end of the "
                + "scrolltext."
                + "\n\n\n\n\n\n\n\n\n\n\n\n\n"
                + "No, really.\n"
                + "\n\n\n\n\n\n\n\n\n\n\n\n\n"
                + "It's over.\n"
                + "\n\n\n\n\n\n\n\n\n\n\n\n\n"
                + "Please let go now!");

            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_RGB | Glut.GLUT_DOUBLE);
            Glut.glutInitWindowPosition(50, 50);
            Glut.glutInitWindowSize(480, 270);
            Glut.glutCreateWindow("FTGL scrolltext");
            Glut.glutDisplayFunc(Display);
            Glut.glutKeyboardFunc(Parsekey);
            Glut.glutReshapeFunc(Reshape);
            Glut.glutIdleFunc(Idle);
            Glut.glutMainLoop();
        }
Beispiel #23
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE);
            Glut.glutInitWindowSize(width, height);
            Glut.glutInitWindowPosition(pos_x, pos_y);
            Glut.glutCreateWindow(window_Title);
            Glut.glutIdleFunc(onRenderFrame);
            Glut.glutDisplayFunc(onDisplay);

            SHprogram = new ShaderProgram(VertexShader, FragmentShader);
            SHprogram.Use();
            SHprogram["projection_matrix"].SetValue(Matrix4.CreatePerspectiveFieldOfView(0.45f, (float)width / height, 0.1f, 10000f));
            SHprogram["view_matrix"].SetValue(Matrix4.LookAt(new Vector3(0, 0, 10), Vector3.Zero, Vector3.Up));

            triangle     = new VBO <Vector3>(new Vector3[] { new Vector3(-1, -1, 0), new Vector3(1, -1, 0), new Vector3(0, 1, 0) });
            triangle_el  = new VBO <int>(new int[] { 0, 1, 2 }, BufferTarget.ElementArrayBuffer);
            triangle_col = new VBO <Vector3>(new Vector3[] { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1) });

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

            Glut.glutMainLoop();
        }
Beispiel #24
0
        private static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine("Для применения аффинных преобразований используются следующие клавиши:\n" +
                              "- \"q\", \"e\" - для поворота;\n" +
                              "- \"w\", \"s\", \"a\", \"d\" - для переноса;\n" +
                              "- \"r\" - для отражения;\n" +
                              "- стрелки - для масштабирования.\n" +
                              "Следует удостовериться что ввод на английском языке.\n" +
                              "Для запуска нажмите любой символ на клавиатуре.");
            Console.ReadKey();

            Points = SourceData.GetSourcePoints();

            Glut.GlutInit();
            Glut.glutInitWindowSize(700, 700);
            Glut.glutCreateWindow("GeometricModelingLR2");
            Glut.glutInitWindowPosition(100, 100);
            Glut.GlutDisplayFunc(Display);
            Glut.GlutKeyboardFunc(ClickKeyboardKeys);
            Glut.GlutSpecialFunc(ClickSpecialKeys);
            Glut.glutMainLoop();
        }
Beispiel #25
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
 }                                                                      //
Beispiel #26
0
 public static void Execute(int i = 1)
 {
     Glut.glutInit();
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGBA | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(width, height);
     Glut.glutCreateWindow("OpenGL Task2");
     if (i == 1)
     {
         Glut.glutDisplayFunc(RenderTriangle);
     }
     if (i == 2)
     {
         Glut.glutDisplayFunc(RenderQuads);
     }
     if (i == 3)
     {
         isColor = true;
         Glut.glutDisplayFunc(RenderTriangle);
     }
     Init();
     Glut.glutMainLoop();
 }
Beispiel #27
0
        static void Main(string[] args)
        {
            t1.Start();
            t1.IsBackground = true;

            t2.Start();
            t2.IsBackground = true;

            //getserialport();


            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);         // Setup display mode to double buffer and RGB color
            Glut.glutInitWindowSize(800, 800);                                  // Set the screen size
            Glut.glutCreateWindow("OpenGL 3D Navigation Program With Tao");
            init();
            Glut.glutReshapeFunc(reshape);
            Glut.glutDisplayFunc(display);
            Glut.glutSpecialFunc(new Glut.SpecialCallback(specialKey));      // set window's to specialKey callback
            TimerFunction(0);
            //TimerFunction2(0);
            Glut.glutMainLoop();
        }
Beispiel #28
0
        public static void Run()
        {
            // initialize GLUT
            Glut.glutInit();
            // double buffer, use rgb color, enable depth buffer
            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("Shadow");

            // set the display function - called when redrawing
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            // set the idle function - called when idle
            if (isRotating)
            {
                Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            }
            else
            {
                Glut.glutIdleFunc(null);
            }
            // 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();
        }
Beispiel #29
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();
        }
Beispiel #30
0
        static void Main(string[] args)
        {
            Glut.glutInit();

/* need both double buffering and z buffer */

            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(640, 480);
            Glut.glutCreateWindow("OpenGL");
            myInit();
            //mdlviewer_init( "homer.mdl", modelo.homer);
            Glut.glutReshapeFunc(myReshape);
            Glut.glutDisplayFunc(display);
            Glut.glutKeyboardFunc(keyboard);
            Glut.glutSpecialFunc(specialKey);
            Glut.glutMouseFunc(mouse);
            Glut.glutPassiveMotionFunc(mouse);



            imprime_ajuda();

            Glut.glutMainLoop();
        }