示例#1
0
        static void on_display()
        {
            timestep += 0.1f;
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glLoadIdentity();
            //Glu.gluLookAt(0, 0, 5, 0, 0, 1, 0, 1, 0);

            /*
             *
             * Glut.glutSolidTeapot(1);
             */
            Gl.glScaled(1.0 / Globals.defaultwindowwidth, 1.0 / Globals.defaultwindowheight, 1);
            RendererWrapper.currentdepth = 0.0f;
            Globals.currentwindowwidth   = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            Globals.currentwindowheight  = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);

            Globals.panelreg.Update();
            Globals.clickablereg.UpdateGraphics();
            Globals.appreg.UpdatePanels();

            //RendererWrapper.DrawRectangle(new RectangleBox<double>(100 + 50.0 * Math.Sin(timestep), 200 + 50.0 * Math.Sin(timestep), 100, 200), new RGBAColor(1.0, 0.0, 0.0, 1.0), 5, outer: true, glow: true);
            //RendererWrapper.DrawRectangle(new RectangleBox<double>(100+15, 200+15, 100+15, 200+15), new RGBAColor(0.0, 1.0, 0.0, 1.0),5);

            Glut.glutSwapBuffers();
            //Gl.glFinish();
        }
示例#2
0
 private static void Motion(int x, int y)
 {
     y       = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT) - y;
     rasterX = x - oldRasterX;
     rasterY = y - oldRasterY;
     Glut.glutPostRedisplay();
 }
示例#3
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();
        }
示例#4
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();
        }
示例#5
0
        // --- Callbacks ---
        #region Display()
        private static void Display()
        {
            int i;

            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);

            for (i = 0; i < numberStars; i++)
            {
                stars[i].X += stars[i].VX;
                if (stars[i].X < Glut.glutGet(Glut.GLUT_WINDOW_WIDTH))
                {
                    Gl.glBegin(Gl.GL_LINE_STRIP);
                    Gl.glColor3ub(0, 0, 0);
                    Gl.glVertex2i((int)(stars[i].X - stars[i].VX * 4), (int)stars[i].Y);
                    Gl.glColor3ub(255, 255, 255);
                    Gl.glVertex2i((int)stars[i].X, (int)stars[i].Y);
                    Gl.glEnd();
                }
                else
                {
                    stars[i].X = 0;
                }
            }

            Glut.glutSwapBuffers();
        }
示例#6
0
        static void display()
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Gl.glLoadIdentity();
            setCamera();

            material(Estrutura.tipo_material.slate);
            desenhaSolo();
            //desenhaEixos();

            desenhaLabirinto();

            /*glPushMatrix();
             *              glScalef(0.005,0.005,0.005);
             *              modelo.homer.SetSequence(0);
             *  mdlviewer_display(modelo.homer);
             *      glPopMatrix();*/
            if (estado.picking >= 0)
            {
                desenhaInformacao(Glut.glutGet(Glut.GLUT_WINDOW_WIDTH), Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT));
                menuNos();
            }

            if (estado.eixoTranslaccao < 0 && estado.eixoTranslaccao != -4)
            {
                // desenha plano de translacção
                Console.Write("Translate... " + estado.eixoTranslaccao + "\n");
                desenhaPlanoDrag(estado.eixoTranslaccao);
            }

            Glut.glutPostRedisplay();
            Gl.glFlush();
            Glut.glutSwapBuffers();
        }
示例#7
0
        static void setProjection(int x, int y, bool picking)
        {
            Gl.glLoadIdentity();
            if (picking) // se está no modo picking, lê viewport e define zona de picking
            {
                int[] vport = new int[4];
                Gl.glGetIntegerv(Gl.GL_VIEWPORT, vport);
                Glu.gluPickMatrix(x, Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT) - y, 4, 4, vport);  // Inverte o y do rato para corresponder à jana
            }

            Glu.gluPerspective(estado.camera.fov, (float)Glut.glutGet(Glut.GLUT_WINDOW_WIDTH) / Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT), 1, 500);
        }
示例#8
0
        private static void InitLines()
        {
            int    i;
            Point  newborn;
            Random random = new Random();

            firstX  *= step;
            firstY  *= step;
            secondX *= step;
            secondY *= step;

            for (i = 0; i < points; i++)
            {
                newborn      = new Point();
                newborn.Next = first;
                newborn.X    = -1.0f;
                newborn.Y    = -1.0f;
                first        = newborn;
            }

            newborn = first;
            while (newborn.Next != null)
            {
                newborn = newborn.Next;
            }
            newborn.Next = first;

            first.X = random.Next() % Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            first.Y = random.Next() % Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);

            for (i = 0; i < points; i++)
            {
                newborn      = new Point();
                newborn.Next = second;
                newborn.X    = -1.0f;
                newborn.Y    = -1.0f;
                second       = newborn;
            }

            newborn = second;
            while (newborn.Next != null)
            {
                newborn = newborn.Next;
            }
            newborn.Next = second;

            second.X = random.Next() % Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            second.Y = random.Next() % Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);
        }
示例#9
0
文件: Program.cs 项目: mrenow/2D-Game
        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();
        }
示例#10
0
        // --- Callbacks ---
        #region Display()
        private static void Display()
        {
            int width  = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
            int height = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);

            Gl.glViewport(0, 0, width, height);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluOrtho2D(0, width, 0, height);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity();
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glColor3ub(255, 255, 255);
            Gl.glBegin(Gl.GL_LINES);
            Gl.glVertex2i(width / 2, 0);
            Gl.glVertex2i(width / 2, height);
            Gl.glVertex2i(0, height / 2);
            Gl.glVertex2i(width, height / 2);
            Gl.glEnd();

            Gl.glRasterPos2i(5, 5);
            Text("Front");
            Gl.glRasterPos2i(width / 2 + 5, 5);
            Text("Right");
            Gl.glRasterPos2i(5, height / 2 + 5);
            Text("Top");
            Gl.glRasterPos2i(width / 2 + 5, height / 2 + 5);
            Text("Perspective");

            Gl.glEnable(Gl.GL_LIGHTING);

            width  = (width + 1) / 2;
            height = (height + 1) / 2;

            Gl.glEnable(Gl.GL_SCISSOR_TEST);

            // Bottom Left
            Gl.glViewport(0, 0, width, height);
            Gl.glScissor(0, 0, width, height);

            // Front
            Projection(width, height, 0);
            Gl.glRotatef(spinY, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinX, 0.0f, 1.0f, 0.0f);

            Gl.glCallList(torusList);

            // Bottom Right
            Gl.glViewport(width, 0, width, height);
            Gl.glScissor(width, 0, width, height);

            // Right
            Projection(width, height, 0);
            Gl.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
            Gl.glRotatef(spinY, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinX, 0.0f, 1.0f, 0.0f);

            Gl.glCallList(torusList);

            // Top Left
            Gl.glViewport(0, height, width, height);
            Gl.glScissor(0, height, width, height);

            // Top
            Projection(width, height, 0);
            Gl.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinY, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinX, 0.0f, 1.0f, 0.0f);

            Gl.glCallList(torusList);

            // Top Right
            Gl.glViewport(width, height, width, height);
            Gl.glScissor(width, height, width, height);

            // Perspective
            Projection(width, height, 1);
            Gl.glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
            Gl.glRotatef(20.0f, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinY, 1.0f, 0.0f, 0.0f);
            Gl.glRotatef(spinX, 0.0f, 1.0f, 0.0f);

            Gl.glCallList(torusList);

            Gl.glDisable(Gl.GL_SCISSOR_TEST);

            Glut.glutSwapBuffers();
        }
示例#11
0
        // --- Callbacks ---
        #region Display()
        private static void Display()
        {
            if (performanceTiming)
            {
                start = Glut.glutGet(Glut.GLUT_ELAPSED_TIME);
            }

            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            if (drawBackground || drawStars || performanceTiming)
            {
                Gl.glMatrixMode(Gl.GL_PROJECTION);
                Gl.glPushMatrix();
                Gl.glLoadIdentity();
                Gl.glOrtho(0, width, 0, height, -1, 1);
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glPushMatrix();
                Gl.glLoadIdentity();
                Gl.glDepthMask(Gl.GL_FALSE);
                Gl.glDisable(Gl.GL_DEPTH_TEST);
                Gl.glDisable(Gl.GL_LIGHTING);

                if (drawBackground)
                {
                    Gl.glEnable(Gl.GL_TEXTURE_2D);
                    Gl.glBindTexture(Gl.GL_TEXTURE_2D, backgroundTexture);
                    Gl.glColor3ub(255, 255, 255);
                    Gl.glBegin(Gl.GL_QUADS);
                    Gl.glTexCoord2i(0, 0);
                    Gl.glVertex2i(0, 0);
                    Gl.glTexCoord2i(1, 0);
                    Gl.glVertex2i(width, 0);
                    Gl.glTexCoord2i(1, 1);
                    Gl.glVertex2i(width, height);
                    Gl.glTexCoord2i(0, 1);
                    Gl.glVertex2i(0, height);
                    Gl.glEnd();
                    Gl.glDisable(Gl.GL_TEXTURE_2D);
                }

                if (drawStars)
                {
                    Gl.glEnable(Gl.GL_BLEND);
                    Gl.glBegin(Gl.GL_LINES);
                    for (i = 0; i < NUMBERSTARS; i++)
                    {
                        stars[i].X += stars[i].VX;
                        if (stars[i].X < width)
                        {
                            Gl.glColor4ub(0, 0, 0, 0);
                            Gl.glVertex2i((int)(stars[i].X - stars[i].VX * 3), (int)stars[i].Y);
                            Gl.glColor4ub(255, 255, 255, 255);
                            Gl.glVertex2i((int)stars[i].X, (int)stars[i].Y);
                        }
                        else
                        {
                            stars[i].X = 0;
                        }
                    }
                    Gl.glEnd();
                    Gl.glDisable(Gl.GL_BLEND);
                }

                if (performanceTiming)
                {
                    float  fps = (1.0f / ((float)(end - last) / 1000.0f));
                    string s   = fps.ToString("F1") + " FPS";

                    Gl.glColor3ub(255, 255, 255);
                    Gl.glRasterPos2i(5, 5);
                    foreach (char c in s)
                    {
                        Glut.glutBitmapCharacter(Glut.GLUT_BITMAP_HELVETICA_18, c);
                    }
                    last = start;
                }

                Gl.glEnable(Gl.GL_LIGHTING);
                Gl.glEnable(Gl.GL_DEPTH_TEST);
                Gl.glDepthMask(Gl.GL_TRUE);
                Gl.glMatrixMode(Gl.GL_PROJECTION);
                Gl.glPopMatrix();
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glPopMatrix();
            }

            Gl.glPushMatrix();
            if (texturing)
            {
                Gl.glTexGeni(Gl.GL_S, Gl.GL_TEXTURE_GEN_MODE, Gl.GL_SPHERE_MAP);
                Gl.glTexGeni(Gl.GL_T, Gl.GL_TEXTURE_GEN_MODE, Gl.GL_SPHERE_MAP);
                Gl.glEnable(Gl.GL_TEXTURE_GEN_S);
                Gl.glEnable(Gl.GL_TEXTURE_GEN_T);
                Gl.glEnable(Gl.GL_TEXTURE_2D);
            }

            Gl.glRotatef(spinY, 0, 1, 0);
            Gl.glColor3ub(196, 196, 196);
            Glut.glutSolidTorus(RI, RO, lod, lod);

            step = (int)(360.0 / numberSpheres);
            for (i = 0; i < numberSpheres; i++)
            {
                Gl.glPushMatrix();
                Gl.glRotatef(step * i + spinZ, 0, 0, 1);
                Gl.glTranslatef(0, RO, 0);
                Gl.glRotatef(step * i + spinX, 1, 0, 0);
                Gl.glTranslatef(0, RI + RI, 0);
                Color((byte)i);
                Sphere(i % numberTextures + 1);
                Gl.glPopMatrix();
            }

            if (texturing)
            {
                Gl.glDisable(Gl.GL_TEXTURE_GEN_S);
                Gl.glDisable(Gl.GL_TEXTURE_GEN_T);
                Gl.glDisable(Gl.GL_TEXTURE_2D);
            }
            Gl.glPopMatrix();

            Glut.glutSwapBuffers();

            if (performanceTiming)
            {
                end = Glut.glutGet(Glut.GLUT_ELAPSED_TIME);
            }
        }
示例#12
0
 private static void Mouse(int button, int state, int x, int y)
 {
     y          = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT) - y;
     oldRasterX = x - rasterX;
     oldRasterY = y - rasterY;
 }
示例#13
0
        // --- Callbacks ---
        #region Display()
        private static void Display()
        {
            int i;

            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);

            first.Next.X = first.X + firstX;
            first.Next.Y = first.Y + firstY;
            first        = first.Next;

            if (first.X < 0)
            {
                first.X = 0;
                firstX  = -firstX;
            }
            else if (first.X > Glut.glutGet(Glut.GLUT_WINDOW_WIDTH))
            {
                first.X = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
                firstX  = -firstX;
            }

            if (first.Y < 0)
            {
                first.Y = 0;
                firstY  = -firstY;
            }
            else if (first.Y > Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT))
            {
                first.Y = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);
                firstY  = -firstY;
            }

            second.Next.X = second.X + secondX;
            second.Next.Y = second.Y + secondY;
            second        = second.Next;

            if (second.X < 0)
            {
                second.X = 0;
                secondX  = -secondX;
            }
            else if (second.X > Glut.glutGet(Glut.GLUT_WINDOW_WIDTH))
            {
                second.X = Glut.glutGet(Glut.GLUT_WINDOW_WIDTH);
                secondX  = -secondX;
            }

            if (second.Y < 0)
            {
                second.Y = 0;
                secondY  = -secondY;
            }
            else if (second.Y > Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT))
            {
                second.Y = Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT);
                secondY  = -secondY;
            }

            Gl.glBegin(Gl.GL_LINES);
            for (i = 0; i < points; i++)
            {
                Gl.glVertex2i((int)first.X, (int)first.Y);
                Gl.glVertex2i((int)second.X, (int)second.Y);
                Gl.glColor3ub(colors[((color + i) % COLORS), 0], colors[((color + i) % COLORS), 1], colors[((color + i) % COLORS), 2]);
                first  = first.Next;
                second = second.Next;
            }
            Gl.glEnd();

            color++;
            if (color >= COLORS)
            {
                color = 0;
            }

            Glut.glutSwapBuffers();
        }
示例#14
0
        static void PrintText(int nX, int nY, string pszText)
        {
            int lines = 0;

            /*
             * Prepare the OpenGL state
             */
            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glDisable(Gl.GL_DEPTH_TEST);
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glPushMatrix();
            Gl.glLoadIdentity();

            /*
             * Have an orthogonal projection matrix set
             */
            Gl.glOrtho(0, Glut.glutGet(Glut.GLUT_WINDOW_WIDTH),
                       0, Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT),
                       -1, +1
                       );

            /*
             * Now the matrix mode
             */
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glPushMatrix();
            Gl.glLoadIdentity();

            /*
             * Now the main text
             */
            Gl.glColor3ub(0, 0, 0);
            Gl.glRasterPos2i(nX, nY);

            for (int i = 0; i < pszText.Length; i++)
            {
                char p = pszText[i];
                if (p == '\n')
                {
                    lines++;
                    Gl.glRasterPos2i(nX, nY - (lines * 18));
                }

                Glut.glutBitmapCharacter(Glut.GLUT_BITMAP_HELVETICA_18, (int)p);
            }

            /*
             * Revert to the old matrix modes
             */
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glPopMatrix();

            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glPopMatrix();

            /*
             * Restore the old OpenGL states
             */
            Gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glEnable(Gl.GL_LIGHTING);
        }
示例#15
0
        public static void Main(string[] args)
        {
            int menuID, subMenuA, subMenuB;

            Glut.glutInitDisplayString("stencil~2 rgb double depth>=16 samples");
            Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
            Glut.glutInitWindowPosition(100, 100);

            Glut.glutInit();

            subMenuA = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Sub menu A1 (01)", 1);
            Glut.glutAddMenuEntry("Sub menu A2 (02)", 2);
            Glut.glutAddMenuEntry("Sub menu A3 (03)", 3);

            subMenuB = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Sub menu B1 (04)", 4);
            Glut.glutAddMenuEntry("Sub menu B2 (05)", 5);
            Glut.glutAddMenuEntry("Sub menu B3 (06)", 6);
            Glut.glutAddSubMenu("Going to sub menu A", subMenuA);

            menuID = Glut.glutCreateMenu(SampleMenu);
            Glut.glutAddMenuEntry("Entry one", 1);
            Glut.glutAddMenuEntry("Entry two", 2);
            Glut.glutAddMenuEntry("Entry three", 3);
            Glut.glutAddMenuEntry("Entry four", 4);
            Glut.glutAddMenuEntry("Entry five", 5);
            Glut.glutAddSubMenu("Enter sub menu A", subMenuA);
            Glut.glutAddSubMenu("Enter sub menu B", subMenuB);

            Glut.glutCreateWindow("Hello world!");
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleKeyboard));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(SampleSpecial));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Glut.glutInitWindowPosition(200, 200);
            Glut.glutCreateWindow("I am not Jan B.");
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleKeyboard));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(SampleSpecial));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Console.WriteLine("Testing game mode string parsing, don't panic!\n");
            Glut.glutGameModeString("320x240:32@100");
            Glut.glutGameModeString("640x480:16@72");
            Glut.glutGameModeString("1024x768");
            Glut.glutGameModeString(":32@120");
            Glut.glutGameModeString("Toudi glupcze, Danwin bedzie moj!");
            Glut.glutGameModeString("640x480:16@72");

            Glut.glutEnterGameMode();
            Glut.glutDisplayFunc(new Glut.DisplayCallback(SampleDisplay));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(SampleReshape));
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(SampleGameModeKeyboard));
            Glut.glutIdleFunc(new Glut.IdleCallback(SampleIdle));
            Glut.glutAttachMenu(Glut.GLUT_LEFT_BUTTON);

            Console.WriteLine("current window is %ix%i+%i+%i",
                              Glut.glutGet(Glut.GLUT_WINDOW_X), Glut.glutGet(Glut.GLUT_WINDOW_Y),
                              Glut.glutGet(Glut.GLUT_WINDOW_WIDTH), Glut.glutGet(Glut.GLUT_WINDOW_HEIGHT)
                              );

            /*
             * Enter the main FreeGLUT processing loop
             */
            Glut.glutMainLoop();

            Console.WriteLine("glutMainLoop() termination works fine!\n");
        }