コード例 #1
0
 public static void Start()
 {
     Glut.glutDisplayFunc(Display);
     Glut.glutReshapeFunc(Reshape);
     Glut.glutKeyboardFunc(Keyb);
     Glut.glutMainLoop();
 }
コード例 #2
0
        static void Main(string[] args)
        {
            int w = 400;
            int h = 400;

            Glut.glutInit();
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_SINGLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(w, h);
            Glut.glutInitWindowPosition(400, 300);
            Glut.glutCreateWindow("Pradzia");
            Init();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Vaizdavimas));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(Klaviatura));
            Glut.glutCreateMenu(new Glut.CreateMenuCallback(Menu));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Perpiesti));
            Glut.glutAddMenuEntry("Difuse", 1);
            Glut.glutAddMenuEntry("Specular", 2);
            Glut.glutAddMenuEntry("Ambient", 3);
            Glut.glutAddMenuEntry("Du sviesos saltiniai", 4);
            Glut.glutAddMenuEntry("+45 laipsniai X", 5);
            Glut.glutAddMenuEntry("-45 laipsniai X", 6);
            Glut.glutAddMenuEntry("Pabaiga", 9);
            Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);
            Glut.glutMainLoop();
        }
コード例 #3
0
        public static void Main2

            (string[] argv)
        {
            Glut.glutInit();
            //Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_ALPHA | Glut.GLUT_DEPTH);
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(winW, winH);
            Glut.glutCreateWindow("GLViewer");

            Init();

            //if (argv.Length <= 0) return;

            model = new ThreeDSFile("c:\\bmw.3ds" /*argv[0]*/).ThreeDSModel;

            PrintInstructions();

            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutIdleFunc(new Glut.IdleCallback(Idle));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutKeyboardUpFunc(new Glut.KeyboardUpCallback(KeyboardUp));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
            Glut.glutMotionFunc(new Glut.MotionCallback(Motion));
            Glut.glutMainLoop();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: klymya/platformer
        static void Main(string[] args)
        {
            try
            {
                init();
                Glut.glutDisplayFunc(Draw);
                Glut.glutReshapeFunc(reshape);
                Glut.glutKeyboardFunc(new Glut.KeyboardCallback(pressKey));
                Glut.glutSpecialFunc(new Glut.SpecialCallback(specialKey));

                Glut.glutIgnoreKeyRepeat(1);
                Glut.glutKeyboardUpFunc(new Glut.KeyboardUpCallback(releaseKey));

                Glut.glutTimerFunc(33, on_timer, 0);
                Glut.glutMainLoop();
            }
            catch (FileReadException e)
            {
                Console.WriteLine(e.exception);
            }
            catch
            {
                Console.WriteLine("Some unknow expection...=(");
            }
        }
コード例 #5
0
ファイル: Boxes.cs プロジェクト: retahc/old-code
        //private static int loop;
        #endregion Private Fields

        // --- Entry Point ---
        #region Main()
        /// <summary>

        ///

        /// </summary>
        public static void Main()
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DEPTH | Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(400, 400);
            Alut.alutInit();
            window = Glut.glutCreateWindow("OpenAL & OpenGL | www.dev-gallery.com");
            Init();
            Console.WriteLine("Controls:");
            Console.WriteLine("1: Activate Red Sound");
            Console.WriteLine("2: Activate Green Sound");
            Console.WriteLine("3: Activate Blue Sound");
            Console.WriteLine("4: Deactivate Red Sound");
            Console.WriteLine("5: Deactivate Green Sound");
            Console.WriteLine("6: Deactivate Blue Sound");
            Console.WriteLine("W: Move Forward");
            Console.WriteLine("A: Move Left");
            Console.WriteLine("S: Move Backward");
            Console.WriteLine("D: Move Right");
            Console.WriteLine("ESC: Exit");
            Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
            Glut.glutMainLoop();
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: dzaruk23/CG10
        private void button1_Click(object sender, EventArgs e)
        {
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);

            Glut.glutInitWindowSize(500, 500);
            Glut.glutCreateWindow("Чайник");

            Gl.glShadeModel(Gl.GL_SMOOTH);//Установите модель затенения
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glEnable(Gl.GL_LIGHT0);
            float[] light_pos = new float[3] {
                1, 0.5F, 1
            };
            Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light_pos);
            Gl.glClearDepth(1.0f);         //Установите значение буфера глубины (ranges[0,1])
            Gl.glEnable(Gl.GL_DEPTH_TEST); //Включить тест глубины
            Gl.glDepthFunc(Gl.GL_LEQUAL);  //Если два объекта с одинаковыми координатами показывают первый нарисованный
            Gl.glClearColor(255, 255, 255, 1);
            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);

            Glut.glutReshapeFunc(reshape); //Изменение размеров окна
            Glut.glutDisplayFunc(render);  //Функция перерисовки окна
            // Установить обратный вызов ключа окна
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keyboard));
            // Установите для окна специальный обратный вызов
            Glut.glutSpecialFunc(new Glut.SpecialCallback(specialKey));
            // Установить окна для обратного вызова движения мыши
            Glut.glutMouseWheelFunc(new Glut.MouseWheelCallback(processMouseWheel));
            Glut.glutMainLoop();
        }
コード例 #7
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();
        }
コード例 #8
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();
        }
コード例 #9
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();
        }
コード例 #10
0
ファイル: Voronoi.cs プロジェクト: randyridge/tao-framework
        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();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: mrenow/2D-Game
        private static void Init()
        {
            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("Plexico 2D Game - Copyright Alex Tan 2016");
            //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.glutReshapeFunc(OnReshape);
            Glut.glutDisplayFunc(delegate() { });
            Glut.glutIdleFunc(MainGameLoop);

            //Console.SetWindowSize(Console.LargestWindowWidth / 4, Console.LargestWindowHeight / 4);
            //Console.SetWindowPosition(0, 0);
            Mode = ProgramMode.None;

            AssetsManager.Init();
            Input.Init();
            Gui.Init();
            SwitchToTitleScreen();
        }
コード例 #12
0
 /**
  * loppulätinät
  */
 public void shutdown()
 {
     running = false;
     Glut.glutMouseFunc(null);
     Glut.glutMotionFunc(null);
     Glut.glutCloseFunc(null);
     Glut.glutReshapeFunc(null);
 }
コード例 #13
0
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Tutorial");

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

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

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

            // enable blending and set to accumulate the star colors
            Gl.Disable(EnableCap.DepthTest);
            Gl.Enable(EnableCap.Blend);
            Gl.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);

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

            // set up the projection and view matrix
            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, 20), Vector3.Zero, new Vector3(0, 1, 0)));

            // load the star texture
            starTexture = new Texture("star.bmp");

            // each star is simply a quad
            star      = 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) });
            starUV    = new VBO <Vector2>(new Vector2[] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1) });
            starQuads = new VBO <int>(new int[] { 0, 1, 2, 0, 2, 3 }, BufferTarget.ElementArrayBuffer);

            // create 50 stars for this tutorial
            int numStars = 50;

            for (int i = 0; i < numStars; i++)
            {
                stars.Add(new Star(0, (float)i / numStars * 4f, new Vector3((float)generator.NextDouble(), (float)generator.NextDouble(), (float)generator.NextDouble())));
            }

            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  10");

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

            Glut.glutMainLoop();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: tuvshinot/csharp
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowSize(width, height);
            Glut.glutCreateWindow("OpenGL Tutorial");

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

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

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

            Gl.Enable(EnableCap.DepthTest);

            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, 10), Vector3.Zero, new Vector3(0, 1, 0)));

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

            crateTexture = new Texture("crate.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
                new Vector3(1, 1, -1), new Vector3(1, 1, 1), new Vector3(1, -1, 1), new Vector3(1, -1, -1) });      // right
            cubeNormals = new VBO<Vector3>(new Vector3[] {
                new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), 
                new Vector3(0, -1, 0), new Vector3(0, -1, 0), new Vector3(0, -1, 0), new Vector3(0, -1, 0), 
                new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1), new Vector3(0, 0, 1), 
                new Vector3(0, 0, -1), new Vector3(0, 0, -1), new Vector3(0, 0, -1), new Vector3(0, 0, -1), 
                new Vector3(-1, 0, 0), new Vector3(-1, 0, 0), new Vector3(-1, 0, 0), new Vector3(-1, 0, 0), 
                new Vector3(1, 0, 0), new Vector3(1, 0, 0), new Vector3(1, 0, 0), new Vector3(1, 0, 0) });
            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);


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

            Glut.glutMainLoop();
        }
コード例 #15
0
 static void Main()
 {
     Glut.glutInit();
     Glut.glutInitWindowSize(500, 500);
     Glut.glutCreateWindow("Tao Example");
     init_graphics();
     Glut.glutDisplayFunc(on_display);
     Glut.glutReshapeFunc(on_reshape);
     Glut.glutMainLoop();
 }
コード例 #16
0
ファイル: Anti.cs プロジェクト: randyridge/tao-framework
 // --- Entry Point ---
 #region Run()
 /// <summary>
 ///     <para>
 ///         Main Loop.  Open window with initial window size, title bar, RGBA display
 ///         mode, and handle input events.
 ///     </para>
 /// </summary>
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutCreateWindow("Anti");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #17
0
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_INDEX | Glut.GLUT_DEPTH);
     Glut.glutCreateWindow("FogIndexOld");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #18
0
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_SINGLE);
     Glut.glutInitWindowSize(320, 320);
     Glut.glutInitWindowPosition(50, 50);
     Glut.glutCreateWindow("Area");
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #19
0
ファイル: Program.cs プロジェクト: kanta8819/opengl4tutorials
        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();
        }
コード例 #20
0
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(350, 150);
     Glut.glutCreateWindow("Polys");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #21
0
 public static void Main()
 {
     Glut.glutInit();
     Glut.glutInitWindowSize(1000, 1000);
     Glut.glutCreateWindow("Snow_Man");
     Init_graphics();
     Glut.glutDisplayFunc(OnDisplay);
     Glut.glutReshapeFunc(OnReshape);
     Glut.glutTimerFunc(20, Update, 1);
     Glut.glutKeyboardFunc(UpdateKeys);
     Glut.glutMainLoop();
 }
コード例 #22
0
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(440, 120);
     Glut.glutCreateWindow("Stroke");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #23
0
ファイル: FogIndex.cs プロジェクト: randyridge/tao-framework
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_INDEX | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(500, 500);
     Glut.glutCreateWindow("FogIndex");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #24
0
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
     Glut.glutInitWindowSize(500, 500);
     Glut.glutCreateWindow("Robot");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #25
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();
 }
コード例 #26
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("TexProx");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #27
0
ファイル: TeaAmbient.cs プロジェクト: retahc/old-code
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(500, 500);
     Glut.glutCreateWindow("TeaAmbient");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #28
0
ファイル: TexGen.cs プロジェクト: randyridge/tao-framework
 public static void Run()
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
     Glut.glutInitWindowSize(256, 256);
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutCreateWindow("TexGen");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }
コード例 #29
0
ファイル: Program.cs プロジェクト: svetlanama/OPENGL
        static void Main(string[] args)
        {
            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB);
            Glut.glutInitWindowSize(600, 600);
            Glut.glutCreateWindow("OPENGL LB1");
            Init();

            Glut.glutReshapeFunc(Reshape);
            Glut.glutDisplayFunc(Display);

            Glut.glutMainLoop();
        }
コード例 #30
0
 public static void Main(string[] args)
 {
     Glut.glutInit();
     Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH | Glut.GLUT_STENCIL);
     Glut.glutInitWindowSize(400, 400);
     Glut.glutInitWindowPosition(100, 100);
     Glut.glutCreateWindow("Stencil");
     Init();
     Glut.glutDisplayFunc(new Glut.DisplayCallback(Display));
     Glut.glutKeyboardFunc(new Glut.KeyboardCallback(Keyboard));
     Glut.glutReshapeFunc(new Glut.ReshapeCallback(Reshape));
     Glut.glutMainLoop();
 }